From df5666e2a00c422b72ccd4eab58a1d442962419a Mon Sep 17 00:00:00 2001 From: RussFP <1pyxa1@gmail.com> Date: Thu, 1 Feb 2018 12:49:43 +0300 Subject: [PATCH] add PhoneNumberBanned exception to 'def authorize' --- pyrogram/client/client.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py index 5fd75cc0..ea1ea89e 100644 --- a/pyrogram/client/client.py +++ b/pyrogram/client/client.py @@ -37,7 +37,7 @@ from pyrogram.api.errors import ( PhoneNumberUnoccupied, PhoneCodeInvalid, PhoneCodeHashEmpty, PhoneCodeExpired, PhoneCodeEmpty, SessionPasswordNeeded, PasswordHashInvalid, FloodWait, PeerIdInvalid, FilePartMissing, - ChatAdminRequired, FirstnameInvalid + ChatAdminRequired, FirstnameInvalid, PhoneNumberBanned ) from pyrogram.api.types import ( User, Chat, Channel, @@ -283,6 +283,9 @@ class Client: except FloodWait as e: print(e.MESSAGE.format(x=e.x)) time.sleep(e.x) + except PhoneNumberBanned as e: + log.error(e, exc_info=True) + raise except Exception as e: log.error(e, exc_info=True) else: