Add raise_for_status check to push and pull methods

as underlying exceptions(such as push already in progress) will be hidden in the stream generator otherwise.
This commit is contained in:
Bradley Cicenas 2015-06-13 19:09:50 -04:00 committed by Joffrey F
parent 5fa7576e8c
commit badc5b69ad
1 changed files with 4 additions and 0 deletions

View File

@ -914,6 +914,8 @@ class Client(requests.Session):
response = self._post(self._url('/images/create'), params=params,
headers=headers, stream=stream, timeout=None)
self._raise_for_status(response)
if stream:
return self._stream_helper(response)
else:
@ -950,6 +952,8 @@ class Client(requests.Session):
else:
response = self._post_json(u, None, stream=stream, params=params)
self._raise_for_status(response)
return stream and self._stream_helper(response) \
or self._result(response)