Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #93393 > unrolled thread
| Started by | Cameron Simpson <cs@zip.com.au> |
|---|---|
| First post | 2015-07-02 08:50 +1000 |
| Last post | 2015-07-02 08:50 +1000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Python 3 resuma a file download Cameron Simpson <cs@zip.com.au> - 2015-07-02 08:50 +1000
| From | Cameron Simpson <cs@zip.com.au> |
|---|---|
| Date | 2015-07-02 08:50 +1000 |
| Subject | Re: Python 3 resuma a file download |
| Message-ID | <mailman.228.1435792055.3674.python-list@python.org> |
On 01Jul2015 21:51, Peter Otten <__peter__@web.de> wrote: >zljubisic@gmail.com wrote: > >> But how to read chunks? > >Instead of > >> data = response.read() # a `bytes` object >> out_file.write(data) > >use a loop: > >CHUNKSIZE = 16*1024 # for example >while True: > data = response.read(CHUNKSIZE) > if not data: > break > out_file.write(data) It might be worth noting here that Peter's "chunk" is just an arbitrary amount of data to read in a unit. I'm only mentioning this because the HTTP specification has a "chunked-encoding" used to return binary files, and we are not talking about _those_ chunks. Cheers, Cameron Simpson <cs@zip.com.au> Life is uncertain. Eat dessert first. - Jim Blandy
Back to top | Article view | comp.lang.python
csiph-web