mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-26 03:13:45 +03:00
Add and except missing FLOOD_TEST_PHONE_WAIT_X error
This commit is contained in:
parent
8038971753
commit
eaef392a9b
|
@ -13,8 +13,9 @@ from . import helpers as utils, version
|
||||||
from .crypto import rsa, CdnDecrypter
|
from .crypto import rsa, CdnDecrypter
|
||||||
from .errors import (
|
from .errors import (
|
||||||
RPCError, BrokenAuthKeyError, ServerError,
|
RPCError, BrokenAuthKeyError, ServerError,
|
||||||
FloodWaitError, FileMigrateError, TypeNotFoundError,
|
FloodWaitError, FloodTestPhoneWaitError, FileMigrateError,
|
||||||
UnauthorizedError, PhoneMigrateError, NetworkMigrateError, UserMigrateError
|
TypeNotFoundError, UnauthorizedError, PhoneMigrateError,
|
||||||
|
NetworkMigrateError, UserMigrateError
|
||||||
)
|
)
|
||||||
from .network import authenticator, MtProtoSender, Connection, ConnectionMode
|
from .network import authenticator, MtProtoSender, Connection, ConnectionMode
|
||||||
from .tl import TLObject, Session
|
from .tl import TLObject, Session
|
||||||
|
@ -546,7 +547,7 @@ class TelegramBareClient:
|
||||||
# Telegram is having some issues, just retry
|
# Telegram is having some issues, just retry
|
||||||
__log__.error('Telegram servers are having internal errors %s', e)
|
__log__.error('Telegram servers are having internal errors %s', e)
|
||||||
|
|
||||||
except FloodWaitError as e:
|
except (FloodWaitError, FloodTestPhoneWaitError) as e:
|
||||||
__log__.warning('Request invoked too often, wait %ds', e.seconds)
|
__log__.warning('Request invoked too often, wait %ds', e.seconds)
|
||||||
if e.seconds > self.session.flood_sleep_threshold | 0:
|
if e.seconds > self.session.flood_sleep_threshold | 0:
|
||||||
raise
|
raise
|
||||||
|
|
|
@ -63,3 +63,4 @@ SESSION_REVOKED=The authorization has been invalidated, because of the user term
|
||||||
USER_ALREADY_PARTICIPANT=The authenticated user is already a participant of the chat
|
USER_ALREADY_PARTICIPANT=The authenticated user is already a participant of the chat
|
||||||
USER_DEACTIVATED=The user has been deleted/deactivated
|
USER_DEACTIVATED=The user has been deleted/deactivated
|
||||||
FLOOD_WAIT_X=A wait of {} seconds is required
|
FLOOD_WAIT_X=A wait of {} seconds is required
|
||||||
|
FLOOD_TEST_PHONE_WAIT_X=A wait of {} seconds is required in the test servers
|
||||||
|
|
|
@ -79,7 +79,9 @@ def generate_code(output, json_file, errors_desc):
|
||||||
errors = defaultdict(set)
|
errors = defaultdict(set)
|
||||||
# PWRTelegram's API doesn't return all errors, which we do need here.
|
# PWRTelegram's API doesn't return all errors, which we do need here.
|
||||||
# Add some special known-cases manually first.
|
# Add some special known-cases manually first.
|
||||||
errors[420].add('FLOOD_WAIT_X')
|
errors[420].update((
|
||||||
|
'FLOOD_WAIT_X', 'FLOOD_TEST_PHONE_WAIT_X'
|
||||||
|
))
|
||||||
errors[401].update((
|
errors[401].update((
|
||||||
'AUTH_KEY_INVALID', 'SESSION_EXPIRED', 'SESSION_REVOKED'
|
'AUTH_KEY_INVALID', 'SESSION_EXPIRED', 'SESSION_REVOKED'
|
||||||
))
|
))
|
||||||
|
@ -118,6 +120,7 @@ def generate_code(output, json_file, errors_desc):
|
||||||
# Names for the captures, or 'x' if unknown
|
# Names for the captures, or 'x' if unknown
|
||||||
capture_names = {
|
capture_names = {
|
||||||
'FloodWaitError': 'seconds',
|
'FloodWaitError': 'seconds',
|
||||||
|
'FloodTestPhoneWaitError': 'seconds',
|
||||||
'FileMigrateError': 'new_dc',
|
'FileMigrateError': 'new_dc',
|
||||||
'NetworkMigrateError': 'new_dc',
|
'NetworkMigrateError': 'new_dc',
|
||||||
'PhoneMigrateError': 'new_dc',
|
'PhoneMigrateError': 'new_dc',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user