mirror of
https://github.com/kennethreitz/requests.git
synced 2026-06-05 22:50:18 +00:00
chunk_size iter_lines
This commit is contained in:
@@ -6,6 +6,9 @@ History
|
||||
|
||||
* Generate chunked ValueError fix
|
||||
* Proxy configuration by environment variables
|
||||
* Simplification of iter_lines.
|
||||
* New `trust_env` configuration for disabling system/environment hints.
|
||||
|
||||
|
||||
|
||||
0.10.7 (2012-03-07)
|
||||
|
||||
+4
-2
@@ -704,7 +704,7 @@ class Response(object):
|
||||
|
||||
return gen
|
||||
|
||||
def iter_lines(self, decode_unicode=None):
|
||||
def iter_lines(self, chunk_size=10 * 1024, decode_unicode=None):
|
||||
"""Iterates over the response data, one line at a time. This
|
||||
avoids reading the content at once into memory for large
|
||||
responses.
|
||||
@@ -712,7 +712,9 @@ class Response(object):
|
||||
|
||||
pending = None
|
||||
|
||||
for chunk in self.iter_content(chunk_size=10 * 1024, decode_unicode=decode_unicode):
|
||||
for chunk in self.iter_content(
|
||||
chunk_size=chunk_size,
|
||||
decode_unicode=decode_unicode):
|
||||
|
||||
if pending is not None:
|
||||
chunk = pending + chunk
|
||||
|
||||
Reference in New Issue
Block a user