From 70ae12eb77c3a89566e9b480635e0bbd523b4d56 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Mon, 12 Apr 2021 09:21:20 +0200 Subject: [PATCH] Handle ServiceUnavailable errors #664 --- pyrogram/session/session.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyrogram/session/session.py b/pyrogram/session/session.py index 686531e3..cf92bcf3 100644 --- a/pyrogram/session/session.py +++ b/pyrogram/session/session.py @@ -29,7 +29,7 @@ from pyrogram import __copyright__, __license__, __version__ from pyrogram import raw from pyrogram.connection import Connection from pyrogram.crypto import mtproto -from pyrogram.errors import RPCError, InternalServerError, AuthKeyDuplicated, FloodWait +from pyrogram.errors import RPCError, InternalServerError, AuthKeyDuplicated, FloodWait, ServiceUnavailable from pyrogram.raw.all import layer from pyrogram.raw.core import TLObject, MsgContainer, Int, FutureSalt, FutureSalts from .internals import MsgId, MsgFactory @@ -432,7 +432,7 @@ class Session: log.warning(f'[{self.client.session_name}] Sleeping for {amount}s (required by "{query}")') await asyncio.sleep(amount) - except (OSError, TimeoutError, InternalServerError) as e: + except (OSError, TimeoutError, InternalServerError, ServiceUnavailable) as e: if retries == 0: raise e from None