1
0
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:
Alexandre Beloin 2015-02-16 13:27:45 -05:00
parent dbb0e551fc
commit ad29d18bc0

View File

@ -29,7 +29,7 @@ class TraktAPI():
data=json.dumps(data), timeout=self.timeout, verify=self.verify)
resp.raise_for_status()
resp = resp.json()
except (requests.HTTPError, requests.ConnectionError) as e:
except requests.RequestException as e:
code = getattr(e.response, 'status_code', None)
if not code:
# This is pretty much a fatal error if there is no status_code
@ -68,7 +68,7 @@ class TraktAPI():
# convert response to json
resp = resp.json()
except (requests.HTTPError, requests.ConnectionError) as e:
except requests.RequestException as e:
code = getattr(e.response, 'status_code', None)
if not code:
# This is pretty much a fatal error if there is no status_code