Skip to content

Commit 87f0a92

Browse files
author
Marco Ponton
committed
Fixed chunk_size values in iter_content() and iter_lines()
Following discussion about issue #539 Kenneth agreed that a default `chunk_size` of 1 for `iter_lines()` would make more sense, but apparently changed `chunk_size` for `iter_content()` by mistake instead, which did solve the `iter_lines()` issue but also changed the default `iter_content()` chunk to 1 bytes which is not desirable.
1 parent c84012e commit 87f0a92

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

requests/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ def ok(self):
705705
return False
706706
return True
707707

708-
def iter_content(self, chunk_size=1, decode_unicode=False):
708+
def iter_content(self, chunk_size=10 * 1024, decode_unicode=False):
709709
"""Iterates over the response data. This avoids reading the content
710710
at once into memory for large responses. The chunk size is the number
711711
of bytes it should read into memory. This is not necessarily the
@@ -731,7 +731,7 @@ def generate():
731731

732732
return gen
733733

734-
def iter_lines(self, chunk_size=10 * 1024, decode_unicode=None):
734+
def iter_lines(self, chunk_size=1, decode_unicode=None):
735735
"""Iterates over the response data, one line at a time. This
736736
avoids reading the content at once into memory for large
737737
responses.

0 commit comments

Comments
 (0)