mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2025-03-16 12:25:45 +01:00
don't send network_delay to telegram servers
This commit is contained in:
parent
245f5abc45
commit
61dac76bee
2 changed files with 10 additions and 8 deletions
|
@ -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(
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue