Handle GetDialogs FloodWait errors

This commit is contained in:
Dan 2018-02-07 03:35:34 +01:00
parent 6783d7b16f
commit 403a37692c

View File

@ -495,12 +495,17 @@ class Client:
log.info("Dialogs count: {}".format(len(peers)))
while len(dialogs.dialogs) == self.DIALOGS_AT_ONCE:
dialogs = self.send(
functions.messages.GetDialogs(
offset_date, 0, types.InputPeerEmpty(),
self.DIALOGS_AT_ONCE, True
try:
dialogs = self.send(
functions.messages.GetDialogs(
offset_date, 0, types.InputPeerEmpty(),
self.DIALOGS_AT_ONCE, True
)
)
)
except FloodWait as e:
log.info("Get dialogs flood wait: {}".format(e.x))
time.sleep(e.x)
continue
offset_date = parse_dialogs(dialogs)
log.info("Dialogs count: {}".format(len(peers)))