Uh oh!
There was an error while loading. Please reload this page.
Add progress to streaming download - #1268
Conversation
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
florimondmanca
left a comment
There was a problem hiding this comment.
Still need to ponder on this a bit, but very neat implementation (code, docs and tests)!
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
florimondmanca
commented
Sep 9, 2020
Don't think so, since that's directly available as |
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
lovelydinosaur
commented
Sep 9, 2020
Great, thanks! I think this has helped me. understand why I'm a bit wary of It seems to me that it's more likely to lead to brittle code. Also it's not super clear what the behaviour is expected to be in different cases. Eg...
In contrast if we used response=httpx.get(...)
response.num_bytes_downloaded# Determine the final download size.It is true that num_bytes_downloaded=0withhttpx.stream("...") asresponse:
total= ...
withtqdm(total=...) asprogress:
forchunkinresponse.iter_bytes():
download_file.write(chunk)
progress.update(response.num_bytes_downloaded-num_bytes_downloaded)
num_bytes_downloaded=response.num_bytes_downloadedWhat do we think? |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
lovelydinosaur
left a comment
There was a problem hiding this comment.
Lovely bit of functionality to work towards yup!
Really liking the docs example here.
Possible that we ought to be going for a total downloaded bytes API rather than a chunk size API?
cdeler
commented
Sep 9, 2020
I changed For now we can state that there is a correlation between the amount of data (lets say |
Uh oh!
There was an error while loading. Please reload this page.
florimondmanca
left a comment
There was a problem hiding this comment.
Looking good with num_bytes_downloaded too, yup 👍
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
lovelydinosaur
commented
Sep 10, 2020
Have made a couple of minor docs tweaks. |
Having found #1208, I tried to track last downloaded raw chunk of the response.
The question is: