Skip to content

Commit

Permalink
Merge pull request twisted#233 from ktdreyer/example-unbuffered
Browse files Browse the repository at this point in the history
examples: stream downloaded file without buffering
  • Loading branch information
twm authored Feb 7, 2019
2 parents 2d45c82 + a9872df commit e85b37a
Showing 1 changed file with 1 addition 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

0 comments on commit e85b37a

Please sign in to comment.