aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRahiel Kasim <rahiel@protonmail.ch>2015-11-10 16:09:42 +0100
committerRahiel Kasim <rahiel@protonmail.ch>2015-11-10 16:09:42 +0100
commit07093a476952a856bedbe085e3ba5a2a68f12ee3 (patch)
treed4f81a51e9dbbfe21e3ebde82664b6a8bf06f4b2
parent7e61e5e67eaee807fb5c6f167b51560c37b3198e (diff)
handle timing out of long-polling, remove old exception
-rw-r--r--bismillah.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/bismillah.py b/bismillah.py
index 090f00c..2358c50 100644
--- a/bismillah.py
+++ b/bismillah.py
@@ -66,13 +66,9 @@ def main():
while True:
try:
update_id = serve(bot, update_id, data)
- except ValueError as e:
- # ValueError: No JSON object could be decoded
- sleep(3)
except telegram.TelegramError as e:
- if "Bad Gateway" in e.message:
- # telegram.error.TelegramError: Bad Gateway
- sleep(5)
+ if e.message in ("Bad Gateway", "Timed out"):
+ sleep(3)
else:
raise e
except URLError as e: