diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-02-11 22:32:48 +0100 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-02-11 22:32:48 +0100 |
commit | 4f444d0e3d6dbe8031b41055cc6147f9f692a0d6 (patch) | |
tree | 5b77db45bc13fbe68337ed15bb60218eee863ec7 /bin/updater.py | |
parent | e6991aa355c8318f362aeabec21fda2cb1874853 (diff) |
also expect http exceptions
Diffstat (limited to 'bin/updater.py')
-rw-r--r-- | bin/updater.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/bin/updater.py b/bin/updater.py index 149ef5b3d..94156950f 100644 --- a/bin/updater.py +++ b/bin/updater.py @@ -30,6 +30,7 @@ import threading import socket import urllib.request import urllib.error +from http.client import HTTPException def get_basic_auth_opener(url, user, password): auth = urllib.request.HTTPPasswordMgrWithDefaultRealm() @@ -72,7 +73,7 @@ class UpdateThread(threading.Thread): try: opener = get_basic_auth_opener(url, self.user, self.password) opener.open(url, timeout=self.timeout) - except (urllib.error.HTTPError, urllib.error.URLError, + except (urllib.error.HTTPError, urllib.error.URLError, HTTPException, socket.timeout) as e: print('%s: %s' % (url, e)) @@ -130,7 +131,7 @@ class Updater: # wait until the interval finished to run again time.sleep(self.interval) - except (ValueError, urllib.error.HTTPError, + except (ValueError, urllib.error.HTTPError, HTTPException, urllib.error.URLError) as e: print('%s: %s' % (self.base_url, e)) print('Trying again in 30 seconds') |