aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar jesopo2016-06-24 09:17:54 +0100
committerGravatar jesopo2016-06-24 09:17:54 +0100
commit64474b261aa884fcc8337a484c99a8c4c6f0a37b (patch)
tree1391cd2323c75872a6dfd90c2d7b457a7b249f69
parentadded a part command to admin.py. (diff)
added handling URLError to Utils.get_url.
-rw-r--r--Utils.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Utils.py b/Utils.py
index 6fef833b..fd6a71e8 100644
--- a/Utils.py
+++ b/Utils.py
@@ -59,6 +59,12 @@ def get_url(url, **kwargs):
return e.code, False
else:
return False
+ except urllib.error.URLError as e:
+ traceback.print_exc()
+ if kwargs.get("code"):
+ return -1, False
+ else:
+ return False
response_content = response.read()
encoding = response.info().get_content_charset()