From 662c69e09c56eba131931460f42608546956c3b9 Mon Sep 17 00:00:00 2001 From: Ihor Polyakov Date: Sun, 2 Apr 2017 14:56:53 +0700 Subject: [PATCH] RecursionError fix during sending files --- telebot/apihelper.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/telebot/apihelper.py b/telebot/apihelper.py index f5fe0ee..90a101a 100644 --- a/telebot/apihelper.py +++ b/telebot/apihelper.py @@ -3,8 +3,9 @@ import requests try: from requests.packages.urllib3 import fields + format_header_param = fields.format_header_param except ImportError: - fields = None + format_header_param = None import telebot from telebot import types from telebot import util @@ -33,8 +34,8 @@ def _make_request(token, method_name, method='get', params=None, files=None, bas logger.debug("Request: method={0} url={1} params={2} files={3}".format(method, request_url, params, files)) read_timeout = READ_TIMEOUT connect_timeout = CONNECT_TIMEOUT - if files and fields: - fields.format_header_param = _no_encode(fields.format_header_param) + if files and format_header_param: + fields.format_header_param = _no_encode(format_header_param) if params: if 'timeout' in params: read_timeout = params['timeout'] + 10 if 'connect-timeout' in params: connect_timeout = params['connect-timeout'] + 10