Log exceptions
This commit is contained in:
parent
9d625c87ee
commit
287c4ac349
3 changed files with 13 additions and 14 deletions
|
|
@ -1,6 +1,7 @@
|
|||
from datetime import datetime, timedelta, timezone
|
||||
import hashlib
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import urllib.parse
|
||||
import urllib.request
|
||||
|
|
@ -97,12 +98,12 @@ class IDFMAPI:
|
|||
with urllib.request.urlopen(req) as f:
|
||||
with open(cache_file, 'wb') as fd:
|
||||
fd.write(f.read())
|
||||
except ConnectionResetError:
|
||||
pass
|
||||
except urllib.error.URLError:
|
||||
pass
|
||||
except urllib.error.HTTPError:
|
||||
pass
|
||||
except ConnectionResetError as e:
|
||||
logging.exception(e)
|
||||
except urllib.error.URLError as e:
|
||||
logging.exception(e)
|
||||
except urllib.error.HTTPError as e:
|
||||
logging.exception(e)
|
||||
|
||||
with open(cache_file) as f:
|
||||
res = json.load(f)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue