Add FloodWait except to media download (#19)

Add FloodWait except to media download to handle this error from the script.

Before this change the exception would only be printed and the script would continue without a way to detect this error.

Co-authored-by: KNF Apps <jordyamc@users.noreply.github.com>
This commit is contained in:
aoleg94 2024-01-10 01:26:34 +05:00 committed by GitHub
parent d0b71cf2a9
commit da4b467e8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -802,6 +802,9 @@ class Client(Methods):
if isinstance(e, asyncio.CancelledError): if isinstance(e, asyncio.CancelledError):
raise e raise e
if isinstance(e, pyrogram.errors.FloodWait):
raise e
return None return None
else: else:
if in_memory: if in_memory:
@ -1033,6 +1036,8 @@ class Client(Methods):
await cdn_session.stop() await cdn_session.stop()
except pyrogram.StopTransmission: except pyrogram.StopTransmission:
raise raise
except pyrogram.errors.FloodWait:
raise
except Exception as e: except Exception as e:
log.exception(e) log.exception(e)