Ensure HTTP errors raise exceptions even when response processing is disabled
This commit is contained in:
parent
e8806426ce
commit
533c2661b1
2 changed files with 22 additions and 2 deletions
|
@ -113,7 +113,11 @@ class Http(object):
|
|||
if process_response:
|
||||
return self._process_response(response)
|
||||
else:
|
||||
return response.text
|
||||
if 200 <= response.status_code < 300:
|
||||
return response.text
|
||||
else:
|
||||
raise TroveboxError("HTTP Error %d: %s" %
|
||||
(response.status_code, response.reason))
|
||||
|
||||
def post(self, endpoint, process_response=True, files=None, **params):
|
||||
"""
|
||||
|
@ -163,7 +167,11 @@ class Http(object):
|
|||
if process_response:
|
||||
return self._process_response(response)
|
||||
else:
|
||||
return response.text
|
||||
if 200 <= response.status_code < 300:
|
||||
return response.text
|
||||
else:
|
||||
raise TroveboxError("HTTP Error %d: %s" %
|
||||
(response.status_code, response.reason))
|
||||
|
||||
def _construct_url(self, endpoint):
|
||||
"""Return the full URL to the specified endpoint"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue