From 398bc9e9ea3d76f1f2e18e2641e9cd8558cd815f Mon Sep 17 00:00:00 2001 From: Donald Stufft Date: Fri, 16 May 2014 14:08:09 -0400 Subject: Upgrade requests to 2.3.0 --- pip/_vendor/requests/exceptions.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'pip/_vendor/requests/exceptions.py') 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.""" -- cgit v1.2.1