From 197dd2a582191ccf701fb4e3473e836e63b3125a Mon Sep 17 00:00:00 2001 From: Pavel Ermolaev Date: Fri, 24 Apr 2020 23:30:10 +0500 Subject: [PATCH] add requests session for use torpy --- telebot/apihelper.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/telebot/apihelper.py b/telebot/apihelper.py index 8eb4744..1aaa536 100644 --- a/telebot/apihelper.py +++ b/telebot/apihelper.py @@ -20,6 +20,7 @@ from telebot import util logger = telebot.logger proxy = None +session = None API_URL = None FILE_URL = None @@ -33,7 +34,7 @@ ENABLE_MIDDLEWARE = False def _get_req_session(reset=False): - return util.per_thread('req_session', lambda: requests.session(), reset) + return util.per_thread('req_session', lambda: session if session else requests.session(), reset) def _make_request(token, method_name, method='get', params=None, files=None):