diff options
author | Donald Stufft <donald@stufft.io> | 2014-05-16 14:08:09 -0400 |
---|---|---|
committer | Donald Stufft <donald@stufft.io> | 2014-05-16 14:11:53 -0400 |
commit | 398bc9e9ea3d76f1f2e18e2641e9cd8558cd815f (patch) | |
tree | 197e773bb78d7cd906d500d45a5d4eed30fc553f /pip/_vendor/requests/exceptions.py | |
parent | 93098d0c6781dd7019dfa43d9030f14b28f1bf2d (diff) | |
download | pip-398bc9e9ea3d76f1f2e18e2641e9cd8558cd815f.tar.gz |
Upgrade requests to 2.3.0
Diffstat (limited to 'pip/_vendor/requests/exceptions.py')
-rw-r--r-- | pip/_vendor/requests/exceptions.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/pip/_vendor/requests/exceptions.py b/pip/_vendor/requests/exceptions.py index cd3c76001..a4ee9d630 100644 --- a/pip/_vendor/requests/exceptions.py +++ b/pip/_vendor/requests/exceptions.py @@ -14,15 +14,22 @@ class RequestException(IOError): """There was an ambiguous exception that occurred while handling your request.""" + def __init__(self, *args, **kwargs): + """ + Initialize RequestException with `request` and `response` objects. + """ + response = kwargs.pop('response', None) + self.response = response + self.request = kwargs.pop('request', None) + if (response is not None and not self.request and + hasattr(response, 'request')): + self.request = self.response.request + super(RequestException, self).__init__(*args, **kwargs) + class HTTPError(RequestException): """An HTTP error occurred.""" - def __init__(self, *args, **kwargs): - """ Initializes HTTPError with optional `response` object. """ - self.response = kwargs.pop('response', None) - super(HTTPError, self).__init__(*args, **kwargs) - class ConnectionError(RequestException): """A Connection error occurred.""" |