Skip to content

Commit

Permalink
Document request(unbuffered=True), add to example
Browse files Browse the repository at this point in the history
  • Loading branch information
twm committed Dec 9, 2016
1 parent 961a38c commit d4c7725
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/examples/download_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

def download_file(reactor, url, destination_filename):
destination = open(destination_filename, 'wb')
d = treq.get(url)
d = treq.get(url, unbuffered=True)
d.addCallback(treq.collect, destination.write)
d.addBoth(lambda _: destination.close())
return d
Expand Down
3 changes: 3 additions & 0 deletions treq/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ def request(method, url, **kwargs):
(i.e. Ignore RFC2616 section 10.3 and follow redirects from
POST requests). Default: ``False``
:param bool unbuffered: Pass ``True`` to to disable response buffering. By
default treq buffers the entire response body in memory.
:rtype: Deferred that fires with an IResponse provider.
"""
Expand Down

0 comments on commit d4c7725

Please sign in to comment.