exceptions: use url from Reponse object
Change-Id: Ie98c893e7ae90d9d5aee8cb02be62069547ccb08
This commit is contained in:
parent
5f2fd1cef7
commit
89abfd6cc0
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue