From: Tim Konick Date: Mon, 22 Sep 2014 19:51:59 +0000 (-0400) Subject: using the `StreamConsumedError` X-Git-Tag: v2.4.2~3^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6e5f7bb9d397ade498ee22d9785863ef1b8ad946;p=services%2Fpython-requests.git using the `StreamConsumedError` --- diff --git a/requests/models.py b/requests/models.py index 5974507..897cd6f 100644 --- a/requests/models.py +++ b/requests/models.py @@ -22,8 +22,9 @@ from .packages.urllib3.util import parse_url from .packages.urllib3.exceptions import ( DecodeError, ReadTimeoutError, ProtocolError) from .exceptions import ( - HTTPError, RequestException, MissingSchema, InvalidURL, - ChunkedEncodingError, ContentDecodingError, ConnectionError) + HTTPError, RequestException, MissingSchema, InvalidURL, + ChunkedEncodingError, ContentDecodingError, ConnectionError, + StreamConsumedError) from .utils import ( guess_filename, get_auth_from_url, requote_uri, stream_decode_response_unicode, to_key_val_list, parse_header_links, @@ -656,8 +657,7 @@ class Response(object): self._content_consumed = True if self._content_consumed and isinstance(self._content, bool): - raise RuntimeError( - 'The content for this response was already consumed') + raise StreamConsumedError() # simulate reading small chunks of the content reused_chunks = iter_slices(self._content, chunk_size)