1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

Merge pull request #318 from ihoru/master

RecursionError fix during sending files
This commit is contained in:
FrankWang 2017-04-05 14:13:22 +08:00 committed by GitHub
commit d29c816b79

View File

@ -3,8 +3,9 @@
import requests import requests
try: try:
from requests.packages.urllib3 import fields from requests.packages.urllib3 import fields
format_header_param = fields.format_header_param
except ImportError: except ImportError:
fields = None format_header_param = None
import telebot import telebot
from telebot import types from telebot import types
from telebot import util 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)) logger.debug("Request: method={0} url={1} params={2} files={3}".format(method, request_url, params, files))
read_timeout = READ_TIMEOUT read_timeout = READ_TIMEOUT
connect_timeout = CONNECT_TIMEOUT connect_timeout = CONNECT_TIMEOUT
if files and fields: if files and format_header_param:
fields.format_header_param = _no_encode(fields.format_header_param) fields.format_header_param = _no_encode(format_header_param)
if params: if params:
if 'timeout' in params: read_timeout = params['timeout'] + 10 if 'timeout' in params: read_timeout = params['timeout'] + 10
if 'connect-timeout' in params: connect_timeout = params['connect-timeout'] + 10 if 'connect-timeout' in params: connect_timeout = params['connect-timeout'] + 10