Fix typo in comment message
an request => a request rest => resp exception_from_response() => exceptions.from_response() '.' operator means call from_response() in exceptions module. Change-Id: I5e780dd2882b39d1b39f7c64bf274e90934c09ec Signed-off-by: Lin Yang <lin.a.yang@intel.com>
This commit is contained in:
parent
167a75156d
commit
56778a1220
@ -157,14 +157,14 @@ _code_map = dict((c.http_status, c) for c in [BadRequest, Unauthorized,
|
|||||||
|
|
||||||
def from_response(response, body):
|
def from_response(response, body):
|
||||||
"""
|
"""
|
||||||
Return an instance of an ClientException or subclass
|
Return an instance of a ClientException or subclass
|
||||||
based on an requests response.
|
based on a requests response.
|
||||||
|
|
||||||
Usage::
|
Usage::
|
||||||
|
|
||||||
resp, body = requests.request(...)
|
resp, body = requests.request(...)
|
||||||
if resp.status_code != 200:
|
if resp.status_code != 200:
|
||||||
raise exception_from_response(resp, rest.text)
|
raise exceptions.from_response(resp, resp.text)
|
||||||
"""
|
"""
|
||||||
cls = _code_map.get(response.status_code, ClientException)
|
cls = _code_map.get(response.status_code, ClientException)
|
||||||
if response.headers:
|
if response.headers:
|
||||||
|
Loading…
Reference in New Issue
Block a user