Skip to content
Myr

iter_lines py3 compatibility

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

#470

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

  • other:+2 added−3 removed

1 file+2 added−3 removed

modified:requests/models.py+2 added-3 removed
705 unmodified lines
706 gen = stream_decode_response_unicode(gen, self)707708 return gen709710 def iter_lines(self, chunk_size=10 * 1024, decode_unicode=None):710 def iter_lines(self, chunk_size=10 * 1024, decode_unicode=True):711 """Iterates over the response data, one line at a time. This712 avoids reading the content at once into memory for large713 responses.714 """
7 unmodified lines
722 if pending is not None:723 chunk = pending + chunk724 lines = chunk.splitlines()725726 # An incomplete line.727 if lines[-1].endswith(chunk[-1]):726 if lines[-1][-1] == chunk[-1]:727 pending = lines.pop()728 else:729 pending = None730
72 unmodified lines