aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRahiel Kasim <rahielkasim@gmail.com>2016-01-25 22:37:57 +0100
committerRahiel Kasim <rahielkasim@gmail.com>2016-01-25 23:10:04 +0100
commit177f93c4aae6ae034ed7eb55e510bff5d571449d (patch)
tree45d5eb54b9e3fdec8d40b07ec6344f665c0f1be7
parent9aacba86e6f8743343c9d29fbcd888278c56287b (diff)
update network exceptions and copyright
-rw-r--r--bismillah.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/bismillah.py b/bismillah.py
index 5da1828..4553f3a 100644
--- a/bismillah.py
+++ b/bismillah.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
###############################################################################
# BismillahBot -- Explore the Noble Qur'an on Telegram #
-# Copyright (C) 2015 Rahiel Kasim #
+# Copyright (C) 1436-1437 AH Rahiel Kasim #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU Affero General Public License as published by #
@@ -17,9 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
###############################################################################
import re
-from time import sleep
-from urllib2 import URLError
-from time import time
+from time import sleep, time
import sys
import telegram
@@ -73,14 +71,14 @@ def main():
try:
update_id = serve(bot, update_id, data)
except telegram.TelegramError as e:
- if e.message in ("Bad Gateway", "Timed out"):
- sleep(2)
+ if e.message in ("Bad Gateway", "Timed out") or (
+ e.message.startswith("URLError") or
+ e.message.startswith("HTTPException")):
+ sleep(1)
elif e.message == "Unauthorized":
update_id += 1
else:
raise e
- except URLError as e:
- sleep(2)
def serve(bot, update_id, data):