mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
Update asyncio_helper.py
This commit is contained in:
parent
da5084f53c
commit
0028feb4c5
@ -21,7 +21,7 @@ session = None
|
||||
|
||||
FILE_URL = None
|
||||
|
||||
REQUEST_TIMEOUT = None
|
||||
REQUEST_TIMEOUT = 300
|
||||
MAX_RETRIES = 3
|
||||
|
||||
REQUEST_LIMIT = 50
|
||||
@ -63,12 +63,11 @@ async def _process_request(token, url, method='get', params=None, files=None, **
|
||||
# ClientTimeout only.
|
||||
# timeout should be added to params for getUpdates. All other timeout's should be used
|
||||
# for request timeout.
|
||||
try:
|
||||
request_timeout = kwargs.pop('request_timeout')
|
||||
# if exception wasn't raised, then we have request_timeout in kwargs(this is getUpdates method)
|
||||
# so we will simply apply that request_timeout to ClientTimeout
|
||||
except KeyError:
|
||||
# exception was raised, so we know that this method is not getUpdates.
|
||||
request_timeout = kwargs.pop('request_timeout', False)
|
||||
# if we got some value, then we have request_timeout in kwargs(this is getUpdates method)
|
||||
# so we will simply apply that request_timeout to ClientTimeout
|
||||
# and if we got False, then we don't have request_timeout in kwargs(this is not getUpdates method)
|
||||
if request_timeout is False:
|
||||
# let's check for timeout in params
|
||||
request_timeout = params.pop('timeout', None)
|
||||
# we will apply default request_timeout if there is no timeout in params
|
||||
|
Loading…
Reference in New Issue
Block a user