11#!/usr/bin/env python
2- # pylint: disable=no-name-in-module,unused-import
32#
43# A library that provides a Python interface to the Telegram Bot API
54# Copyright (C) 2015-2016
2524import socket
2625from ssl import SSLError
2726
28- try :
29- # python2
30- from httplib import HTTPException
31- except ImportError :
32- # python3
33- from http .client import HTTPException
34-
35- try :
36- # python3
37- from urllib .request import urlopen , urlretrieve , Request
38- from urllib .error import HTTPError , URLError
39- except ImportError :
40- # python2
41- from urllib import urlretrieve
42- from urllib2 import urlopen , Request , URLError
43- from urllib2 import HTTPError
27+ from future .moves .http .client import HTTPException
28+ from future .moves .urllib .error import HTTPError , URLError
29+ from future .moves .urllib .request import urlopen , urlretrieve , Request
4430
4531from telegram import (InputFile , TelegramError )
4632from telegram .error import Unauthorized , NetworkError , TimedOut
@@ -130,8 +116,7 @@ def get(url):
130116@_try_except_req
131117def post (url ,
132118 data ,
133- timeout = None ,
134- network_delay = 2. ):
119+ timeout = None ):
135120 """Request an URL.
136121 Args:
137122 url:
@@ -141,11 +126,6 @@ def post(url,
141126 timeout:
142127 float. If this value is specified, use it as the definitive timeout (in
143128 seconds) for urlopen() operations. [Optional]
144- network_delay:
145- float. If using the timeout specified in `data` (which is a timeout for
146- the Telegram servers operation), then `network_delay` as an extra delay
147- (in seconds) to compensate for network latency.
148- default: 2 [Optional]
149129
150130 Notes:
151131 If neither `timeout` nor `data['timeout']` is specified. The underlying
@@ -159,8 +139,6 @@ def post(url,
159139
160140 if timeout is not None :
161141 urlopen_kwargs ['timeout' ] = timeout
162- elif 'timeout' in data :
163- urlopen_kwargs ['timeout' ] = data ['timeout' ] + network_delay
164142
165143 if InputFile .is_inputfile (data ):
166144 data = InputFile (data )
0 commit comments