don't send network_delay to telegram servers

This commit is contained in:
Jannes Höke 2015-11-10 22:40:19 +01:00
parent 245f5abc45
commit 61dac76bee
2 changed files with 10 additions and 8 deletions

View file

@ -650,7 +650,7 @@ class Bot(TelegramObject):
offset=None,
limit=100,
timeout=0,
network_delay=2):
network_delay=2.):
"""Use this method to receive incoming updates using long polling.
Args:
@ -685,10 +685,8 @@ class Bot(TelegramObject):
data['limit'] = limit
if timeout:
data['timeout'] = timeout
if network_delay:
data['network_delay'] = network_delay
result = request.post(url, data)
result = request.post(url, data, network_delay=network_delay)
if result:
self.logger.info(

View file

@ -67,13 +67,17 @@ def get(url):
def post(url,
data):
data,
network_delay=2.):
"""Request an URL.
Args:
url:
The web location we want to retrieve.
data:
A dict of (str, unicode) key/value pairs.
network_delay:
Additional timeout in seconds to allow the response from Telegram to
take some time.
Returns:
A JSON object.
@ -82,10 +86,10 @@ def post(url,
# Add time to the timeout of urlopen to allow data to be transferred over
# the network.
if 'timeout' in data:
if 'network_delay' in data:
timeout = data['timeout'] + data['network_delay']
if network_delay:
timeout = data['timeout'] + network_delay
else:
timeout = data['timeout'] + 2.
timeout = data['timeout']
else:
timeout = None