Skip to content

Commit

Permalink
handle badserversalt .,.,.,,.
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew (from workstation) committed Dec 5, 2020
1 parent 4c415f7 commit bc2e56a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions smart_tv_telegram/mtproto.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import functools
import os
import pickle
import typing

import pyrogram

Expand All @@ -11,9 +12,10 @@
from pyrogram.raw.functions.help import GetConfig
from pyrogram.raw.functions.messages import GetMessages
from pyrogram.raw.functions.upload import GetFile
from pyrogram.raw.types import InputMessageID, Message, InputDocumentFileLocation
from pyrogram.raw.types import InputMessageID, Message, InputDocumentFileLocation, BadServerSalt
from pyrogram.errors import FloodWait
import pyrogram.session
from pyrogram.raw.types.upload import File

from . import Config

Expand Down Expand Up @@ -81,13 +83,13 @@ async def get_block(self, message: Message, offset: int, block_size: int) -> byt
)
)

while True:
result: typing.Optional[File] = None

while not isinstance(result, File):
try:
result = await session.send(request, sleep_threshold=0)
except FloodWait: # file floodwait is fake
await asyncio.sleep(self._config.file_fake_fw_wait)
else:
break

return result.bytes

Expand Down

0 comments on commit bc2e56a

Please sign in to comment.