Commit 204e79b9 authored by Joshua Harlow's avatar Joshua Harlow

Fix how the http error doesn't always have the response attached

in earlier versions of requests (pre 0.10.8).
parent 6ded151b
......@@ -170,7 +170,9 @@ def readurl(url, data=None, timeout=None, retries=0, sec_between=1,
# attrs
return UrlResponse(r)
except exceptions.RequestException as e:
if isinstance(e, (exceptions.HTTPError)) and e.response:
if (isinstance(e, (exceptions.HTTPError))
and hasattr(e, 'response') # This appeared in v 0.10.8
and e.response):
excps.append(UrlError(e, code=e.response.status_code,
headers=e.response.headers))
else:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment