added handling URLError to Utils.get_url.
This commit is contained in:
parent
d3a1c2db52
commit
64474b261a
1 changed files with 6 additions and 0 deletions
6
Utils.py
6
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()
|
||||
|
|
Loading…
Reference in a new issue