File tree Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -650,7 +650,7 @@ def getUpdates(self,
650
650
offset = None ,
651
651
limit = 100 ,
652
652
timeout = 0 ,
653
- network_delay = 2 ):
653
+ network_delay = 2. ):
654
654
"""Use this method to receive incoming updates using long polling.
655
655
656
656
Args:
@@ -685,10 +685,8 @@ def getUpdates(self,
685
685
data ['limit' ] = limit
686
686
if timeout :
687
687
data ['timeout' ] = timeout
688
- if network_delay :
689
- data ['network_delay' ] = network_delay
690
688
691
- result = request .post (url , data )
689
+ result = request .post (url , data , network_delay = network_delay )
692
690
693
691
if result :
694
692
self .logger .info (
Original file line number Diff line number Diff line change @@ -67,13 +67,17 @@ def get(url):
67
67
68
68
69
69
def post (url ,
70
- data ):
70
+ data ,
71
+ network_delay = 2. ):
71
72
"""Request an URL.
72
73
Args:
73
74
url:
74
75
The web location we want to retrieve.
75
76
data:
76
77
A dict of (str, unicode) key/value pairs.
78
+ network_delay:
79
+ Additional timeout in seconds to allow the response from Telegram to
80
+ take some time.
77
81
78
82
Returns:
79
83
A JSON object.
@@ -82,10 +86,10 @@ def post(url,
82
86
# Add time to the timeout of urlopen to allow data to be transferred over
83
87
# the network.
84
88
if 'timeout' in data :
85
- if ' network_delay' in data :
86
- timeout = data ['timeout' ] + data [ ' network_delay' ]
89
+ if network_delay :
90
+ timeout = data ['timeout' ] + network_delay
87
91
else :
88
- timeout = data ['timeout' ] + 2.
92
+ timeout = data ['timeout' ]
89
93
else :
90
94
timeout = None
91
95
You can’t perform that action at this time.
0 commit comments