From dc92564d97613c8175e5c95a0ba96e58654e6177 Mon Sep 17 00:00:00 2001 From: Flavio Machado Date: Sun, 20 Jun 2021 09:06:26 -0300 Subject: [PATCH] Use Long Polling It is best practice not to flood Telegram's servers with requests, when you can use Long Polling. --- part1/echobot.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/part1/echobot.py b/part1/echobot.py index 438401f..65e82f9 100644 --- a/part1/echobot.py +++ b/part1/echobot.py @@ -23,9 +23,9 @@ def get_json_from_url(url): def get_updates(offset=None): - url = URL + "getUpdates" + url = URL + "getUpdates?timeout=100" if offset: - url += "?offset={}".format(offset) + url += "&offset={}".format(offset) js = get_json_from_url(url) return js @@ -69,4 +69,4 @@ def main(): if __name__ == '__main__': - main() \ No newline at end of file + main()