Closed W4RH4WK closed 9 years ago
Thanks!
I think it might be worth giving callback keyword a more descriptive name, like "chunk_callback" and passing it a session id, so that it can also be used to e.g. store that to resume download after process restart, and can be just left unused in case of simple progress report.
I'll probably add these on top.
In a8a44ab I've changed "callback -> chunk_callback" and made code pass it the following stuff:
chunk_callback(
bytes_uploaded=c, bytes_count=src_len,
chunk_n=n, chunk_count=cn, bits_session_id=bits_sid )
Idea behind using keywords is that you can easily ignore unneeded ones in callbacks, which is not the case with positional args, e.g. in case of progress-callback above, you can have:
def my_callback(bytes_uploaded, bytes_count, **kws):
And not worry about all the unneeded stuff and/or possible future additions there.
Though now that I see naming of the keywords in your callback, I think I'll also change "uploaded -> transferred" and "count -> total", as it makes a lot more sense, I just couldn't come up with the right words in a8a44ab ;)
Though now that I see naming of the keywords in your callback, I think I'll also change "uploaded -> transferred" and "count -> total"
18518c1
great, thank you
It is no problem to do a chunked upload using the
put_bits
method, but I need to do some tasks between chunk uploads (status update and similar). This pull-requests adds an optional callback to the method which will take transferred bytes and total bytes as arguments.