Skip to content
Myr

Always honor decode_unicode, even when _content is present.

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

--HG-- extra : amend_source : 25977a1227b163d49bf2e1aec6aa448e5cd3be8a

authored by Jason R. Coombs · committed by Jason R. Coombs · parent c8226f6 · Browse files · 1 file+8 added−7 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+8 added−7 removed

  • other:+8 added−7 removed

1 file+8 added−7 removed

modified:requests/models.py+8 added-7 removed
619 unmodified lines
620621 If decode_unicode is True, content will be decoded using the best622 available encoding based on the response.623 """624 if self._content_consumed:625 # simulate reading small chunks of the content626 return iter_slices(self._content, chunk_size)627624 def generate():625 try:626 # Special case for urllib3.627 try:
12 unmodified lines
640 yield chunk641642 self._content_consumed = True643648 gen = generate()644 # simulate reading small chunks of the content645 reused_chunks = iter_slices(self._content, chunk_size)646647 stream_chunks = generate()648649 chunks = reused_chunks if self._content_consumed else stream_chunks650651 if decode_unicode:651 gen = stream_decode_response_unicode(gen, self)652 chunks = stream_decode_response_unicode(chunks, self)653653 return gen654 return chunks655656 def iter_lines(self, chunk_size=ITER_CHUNK_SIZE, decode_unicode=None):657 """Iterates over the response data, one line at a time. When658 stream=True is set on the request, this avoids reading the
146 unmodified lines