mirror of
https://github.com/moparisthebest/SickRage
synced 2024-11-17 23:05:11 -05:00
Catch all requests exceptions
This commit is contained in:
parent
dbb0e551fc
commit
ad29d18bc0
@ -29,7 +29,7 @@ class TraktAPI():
|
|||||||
data=json.dumps(data), timeout=self.timeout, verify=self.verify)
|
data=json.dumps(data), timeout=self.timeout, verify=self.verify)
|
||||||
resp.raise_for_status()
|
resp.raise_for_status()
|
||||||
resp = resp.json()
|
resp = resp.json()
|
||||||
except (requests.HTTPError, requests.ConnectionError) as e:
|
except requests.RequestException as e:
|
||||||
code = getattr(e.response, 'status_code', None)
|
code = getattr(e.response, 'status_code', None)
|
||||||
if not code:
|
if not code:
|
||||||
# This is pretty much a fatal error if there is no status_code
|
# This is pretty much a fatal error if there is no status_code
|
||||||
@ -68,7 +68,7 @@ class TraktAPI():
|
|||||||
|
|
||||||
# convert response to json
|
# convert response to json
|
||||||
resp = resp.json()
|
resp = resp.json()
|
||||||
except (requests.HTTPError, requests.ConnectionError) as e:
|
except requests.RequestException as e:
|
||||||
code = getattr(e.response, 'status_code', None)
|
code = getattr(e.response, 'status_code', None)
|
||||||
if not code:
|
if not code:
|
||||||
# This is pretty much a fatal error if there is no status_code
|
# This is pretty much a fatal error if there is no status_code
|
||||||
|
Loading…
Reference in New Issue
Block a user