From da4b467e8ff8118326ce968f83690f5060b1d091 Mon Sep 17 00:00:00 2001 From: aoleg94 Date: Wed, 10 Jan 2024 01:26:34 +0500 Subject: [PATCH] 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 --- pyrogram/client.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pyrogram/client.py b/pyrogram/client.py index 2d4ab500..d2117fa5 100644 --- a/pyrogram/client.py +++ b/pyrogram/client.py @@ -802,6 +802,9 @@ class Client(Methods): if isinstance(e, asyncio.CancelledError): raise e + if isinstance(e, pyrogram.errors.FloodWait): + raise e + return None else: if in_memory: @@ -1033,6 +1036,8 @@ class Client(Methods): await cdn_session.stop() except pyrogram.StopTransmission: raise + except pyrogram.errors.FloodWait: + raise except Exception as e: log.exception(e)