From 620b1364a6778744f4b58ad929b5d2de0a137888 Mon Sep 17 00:00:00 2001 From: Badiboy Date: Sat, 8 Oct 2022 23:41:41 +0300 Subject: [PATCH] Check CUSTOM_REQUEST_SENDER before RETRY_xxx. --- telebot/apihelper.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/telebot/apihelper.py b/telebot/apihelper.py index b4f2b8c..5f8d62e 100644 --- a/telebot/apihelper.py +++ b/telebot/apihelper.py @@ -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 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 current_try = 0 while not got_result and current_try