exceptions: use url from Reponse object

Change-Id: Ie98c893e7ae90d9d5aee8cb02be62069547ccb08
This commit is contained in:
Julien Danjou 2015-12-18 10:12:49 +01:00
parent 5f2fd1cef7
commit 89abfd6cc0
3 changed files with 4 additions and 4 deletions

View File

@ -35,5 +35,5 @@ class SessionClient(adapter.Adapter):
**kwargs)
if raise_exc and resp.status_code >= 400:
raise exceptions.from_response(resp, url, method)
raise exceptions.from_response(resp, method)
return resp

View File

@ -176,7 +176,7 @@ _code_map = dict(
for c in _error_classes)
def from_response(response, url, method=None):
def from_response(response, method=None):
"""Return an instance of one of the ClientException on an requests response.
Usage::
@ -196,7 +196,7 @@ def from_response(response, url, method=None):
kwargs = {
'code': response.status_code,
'method': method,
'url': url,
'url': response.url,
'request_id': req_id,
}

View File

@ -27,5 +27,5 @@ class ExceptionsTest(base.BaseTestCase):
r._content = json.dumps(
{"description": "Archive policy rule foobar does not exist"}
).encode('utf-8')
exc = exceptions.from_response(r, "http://foobar")
exc = exceptions.from_response(r)
self.assertIsInstance(exc, exceptions.ArchivePolicyRuleNotFound)