Skip to content
Myr

using the `StreamConsumedError`

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tim Konick · committed by Tim Konick · parent 58e0a6f · Browse files · 1 file+4 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+4 added−4 removed

  • other:+4 added−4 removed

1 file+4 added−4 removed

modified:requests/models.py+4 added-4 removed
20 unmodified lines
21from .packages.urllib3.util import parse_url22from .packages.urllib3.exceptions import (23 DecodeError, ReadTimeoutError, ProtocolError)24from .exceptions import (25 HTTPError, RequestException, MissingSchema, InvalidURL,26 ChunkedEncodingError, ContentDecodingError, ConnectionError)25 HTTPError, RequestException, MissingSchema, InvalidURL, 26 ChunkedEncodingError, ContentDecodingError, ConnectionError, 27 StreamConsumedError)28from .utils import (29 guess_filename, get_auth_from_url, requote_uri,30 stream_decode_response_unicode, to_key_val_list, parse_header_links,31 iter_slices, guess_json_utf, super_len, to_native_string)
624 unmodified lines
656657 self._content_consumed = True658659 if self._content_consumed and isinstance(self._content, bool):659 raise RuntimeError(660 'The content for this response was already consumed')660 raise StreamConsumedError()661 # simulate reading small chunks of the content662 reused_chunks = iter_slices(self._content, chunk_size)663664 stream_chunks = generate()
157 unmodified lines