Skip to content
Myr

#4965 fix-draw: Accessing response.content twice removes forgets read error.

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

authored by Белавин Денис · committed by Белавин Денис · parent b18f765 · Browse files · 2 files+9 added−0 removed
This commit

State

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

Diff stats

2 files+9 added−0 removed

  • other:+9 added−0 removed

2 files+9 added−0 removed

modified:requests/models.py+8 added
638 unmodified lines
639 #: The :class:`PreparedRequest <PreparedRequest>` object to which this640 #: is a response.641 self.request = None642643 self.error = None644645 def __enter__(self):646 return self647648 def __exit__(self, *args):
102 unmodified lines
751 try:752 for chunk in self.raw.stream(chunk_size, decode_content=True):753 yield chunk754 except ProtocolError as e:755 self._error = e756 raise ChunkedEncodingError(e)757 except DecodeError as e:758 self._error = e759 raise ContentDecodingError(e)760 except ReadTimeoutError as e:761 self._error = e762 raise ConnectionError(e)763 else:764 # Standard file-like object.765 while True:
65 unmodified lines
831 self._content = None832 else:833 self._content = b''.join(self.iter_content(CONTENT_CHUNK_SIZE)) or b''834835 if self._error is not None:836 raise self._error837838 self._content_consumed = True839 # don't need to release the connection; that's been handled by urllib3840 # since we exhausted the data.841 return self._content
120 unmodified lines
modified:AUTHORS.rst+1 added
187 unmodified lines
188- Demetrios Bairaktaris (`@DemetriosBairaktaris <https://github.com/demetriosbairaktaris>`_)189- Darren Dormer (`@ddormer <https://github.com/ddormer>`_)190- Rajiv Mayani (`@mayani <https://github.com/mayani>`_)191- Antti Kaihola (`@akaihola <https://github.com/akaihola>`_)192- Belavin Denis (`@luckydenis <https://github.com/luckydenis>`_)