mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-08 21:10:29 +00:00
Add timeout to connect()
This commit is contained in:
@@ -129,12 +129,14 @@ class TelegramClient(TelegramBareClient):
|
||||
|
||||
# region Connecting
|
||||
|
||||
def connect(self, *args):
|
||||
def connect(self, timeout=timedelta(seconds=5), *args):
|
||||
"""Connects to the Telegram servers, executing authentication if
|
||||
required. Note that authenticating to the Telegram servers is
|
||||
not the same as authenticating the desired user itself, which
|
||||
may require a call (or several) to 'sign_in' for the first time.
|
||||
|
||||
The specified timeout will be used on internal .invoke()'s.
|
||||
|
||||
*args will be ignored.
|
||||
"""
|
||||
return super(TelegramClient, self).connect()
|
||||
|
Reference in New Issue
Block a user