added handling URLError to Utils.get_url.

This commit is contained in:
jesopo 2016-06-24 09:17:54 +01:00
parent d3a1c2db52
commit 64474b261a
No known key found for this signature in database
GPG key ID: 0BBDEB2AEFCFFCB3

View file

@ -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()