check http request status before attempting to decode response
This commit is contained in:
parent
b1537a73ba
commit
eb7a1e369f
2 changed files with 6 additions and 0 deletions
|
|
@ -2321,6 +2321,7 @@ class ClientSession(object):
|
|||
if catcher:
|
||||
warnings.simplefilter("ignore")
|
||||
r = self.rsession.post(handler, **callopts)
|
||||
r.raise_for_status()
|
||||
try:
|
||||
ret = self._read_xmlrpc_response(r)
|
||||
finally:
|
||||
|
|
|
|||
|
|
@ -121,6 +121,11 @@ class Response(object):
|
|||
self.session = session
|
||||
self.response = response
|
||||
|
||||
def raise_for_status(self):
|
||||
if self.response.status >= 400:
|
||||
raise httplib.HTTPException("HTTP %s: %s" % (self.response.status,
|
||||
self.response.reason))
|
||||
|
||||
def iter_content(self, blocksize=8192):
|
||||
# should we check this in Session.post()?
|
||||
# should we even check this here?
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue