mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
Check CUSTOM_REQUEST_SENDER before RETRY_xxx.
This commit is contained in:
parent
7c9b01b10a
commit
620b1364a6
@ -111,7 +111,13 @@ def _make_request(token, method_name, method='get', params=None, files=None):
|
|||||||
|
|
||||||
params = params or None # Set params to None if empty
|
params = params or None # Set params to None if empty
|
||||||
result = None
|
result = None
|
||||||
if RETRY_ON_ERROR and RETRY_ENGINE == 1:
|
|
||||||
|
if CUSTOM_REQUEST_SENDER:
|
||||||
|
# noinspection PyCallingNonCallable
|
||||||
|
result = CUSTOM_REQUEST_SENDER(
|
||||||
|
method, request_url, params=params, files=files,
|
||||||
|
timeout=(connect_timeout, read_timeout), proxies=proxy)
|
||||||
|
elif RETRY_ON_ERROR and RETRY_ENGINE == 1:
|
||||||
got_result = False
|
got_result = False
|
||||||
current_try = 0
|
current_try = 0
|
||||||
while not got_result and current_try<MAX_RETRIES-1:
|
while not got_result and current_try<MAX_RETRIES-1:
|
||||||
@ -146,11 +152,6 @@ def _make_request(token, method_name, method='get', params=None, files=None):
|
|||||||
result = http.request(
|
result = http.request(
|
||||||
method, request_url, params=params, files=files,
|
method, request_url, params=params, files=files,
|
||||||
timeout=(connect_timeout, read_timeout), proxies=proxy)
|
timeout=(connect_timeout, read_timeout), proxies=proxy)
|
||||||
elif CUSTOM_REQUEST_SENDER:
|
|
||||||
# noinspection PyCallingNonCallable
|
|
||||||
result = CUSTOM_REQUEST_SENDER(
|
|
||||||
method, request_url, params=params, files=files,
|
|
||||||
timeout=(connect_timeout, read_timeout), proxies=proxy)
|
|
||||||
else:
|
else:
|
||||||
result = _get_req_session().request(
|
result = _get_req_session().request(
|
||||||
method, request_url, params=params, files=files,
|
method, request_url, params=params, files=files,
|
||||||
|
Loading…
Reference in New Issue
Block a user