mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-05 20:50:22 +03:00
Connection checks
Instead of rasing an exception when running client.start() without an active internet connection, Telethon will handle it itself, advising the user to check his internet connection. The connection will be tried in a loop, until the connection is established, breaking the loop.
This commit is contained in:
parent
bd1b0ecdb4
commit
ed091422b2
|
@ -297,7 +297,14 @@ class TelegramClient(TelegramBareClient):
|
|||
'must only provide one of either')
|
||||
|
||||
if not self.is_connected():
|
||||
self.connect()
|
||||
connected = self.connect()
|
||||
while connected is not True:
|
||||
print("Couldn't establish a connection to Telegram's servers. Check your connection. Trying again...")
|
||||
connected2 = self.connect()
|
||||
if connected2 is True:
|
||||
break
|
||||
else:
|
||||
continue
|
||||
|
||||
if self.is_user_authorized():
|
||||
self._check_events_pending_resolve()
|
||||
|
|
Loading…
Reference in New Issue
Block a user