Skip to content
Myr

iter_content uses new encoding system

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

authored by Kenneth Reitz · committed by Kenneth Reitz · parent 296d8cc · Browse files · 1 file+3 added−3 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+3 added−3 removed

  • other:+3 added−3 removed

1 file+3 added−3 removed

modified:requests/utils.py+3 added-3 removed
294 unmodified lines
295296297def stream_decode_response_unicode(iterator, r):298 """Stream decodes a iterator."""299 encoding = get_encoding_from_headers(r.headers)300 if encoding is None:299300 if r.encoding is None:301 for item in iterator:302 yield item303 return304305 decoder = codecs.getincrementaldecoder(encoding)(errors='replace')305 decoder = codecs.getincrementaldecoder(r.encoding)(errors='replace')306 for chunk in iterator:307 rv = decoder.decode(chunk)308 if rv:309 yield rv
72 unmodified lines