From e414aa281210149c31a6d3935e31b211193074bf Mon Sep 17 00:00:00 2001 From: shriMADhav U k Date: Tue, 14 May 2024 21:36:56 +0200 Subject: [PATCH] pyrofork: Handle FLOOD_PREMIUM_WAIT Squashed commit of the following: commit 546b603 commit 0ac858d commit c8a9725 Ref: https://t.me/swiftgram/72 Signed-off-by: wulan17 --- pyrogram/client.py | 6 ++---- pyrogram/methods/users/get_chat_photos.py | 2 +- pyrogram/session/session.py | 6 ++++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pyrogram/client.py b/pyrogram/client.py index ce290968..7c788067 100644 --- a/pyrogram/client.py +++ b/pyrogram/client.py @@ -941,8 +941,7 @@ class Client(Methods): location=location, offset=offset_bytes, limit=chunk_size - ), - sleep_threshold=30 + ) ) if isinstance(r, raw.types.upload.File): @@ -977,8 +976,7 @@ class Client(Methods): location=location, offset=offset_bytes, limit=chunk_size - ), - sleep_threshold=30 + ) ) elif isinstance(r, raw.types.upload.FileCdnRedirect): diff --git a/pyrogram/methods/users/get_chat_photos.py b/pyrogram/methods/users/get_chat_photos.py index 765aa4c1..6c34d6a5 100644 --- a/pyrogram/methods/users/get_chat_photos.py +++ b/pyrogram/methods/users/get_chat_photos.py @@ -50,7 +50,7 @@ class GetChatPhotos: By default, no limit is applied and all profile photos are returned. Returns: - ``Generator``: A generator yielding :obj:`~pyrogram.types.Photo` | :obj:`~pyrogram.types.Video` objects. + ``Generator``: A generator yielding :obj:`~pyrogram.types.Photo` | :obj:`~pyrogram.types.Animation` objects. Example: .. code-block:: python diff --git a/pyrogram/session/session.py b/pyrogram/session/session.py index a90d2302..bc2e1df7 100644 --- a/pyrogram/session/session.py +++ b/pyrogram/session/session.py @@ -29,7 +29,9 @@ from pyrogram import raw from pyrogram.connection import Connection from pyrogram.crypto import mtproto from pyrogram.errors import ( - RPCError, InternalServerError, AuthKeyDuplicated, FloodWait, ServiceUnavailable, BadMsgNotification, + RPCError, InternalServerError, AuthKeyDuplicated, + FloodWait, FloodPremiumWait, + ServiceUnavailable, BadMsgNotification, SecurityCheckMismatch ) from pyrogram.raw.all import layer @@ -403,7 +405,7 @@ class Session: while True: try: return await self.send(query, timeout=timeout) - except FloodWait as e: + except (FloodWait, FloodPremiumWait) as e: amount = e.value if amount > sleep_threshold >= 0: