I am trying to create a download progress bar in python using the urllib2 http client. I’ve looked through the API (and on google) and it seems that urllib2 does not allow you to register progress hooks. However the older deprecated urllib does have this functionality.
Does anyone know how to create a progress bar or reporting hook using urllib2? Or are there some other hacks to get similar functionality?
Here’s a fully working example that builds on Anurag’s approach of chunking in a response. My version allows you to set the the chunk size, and attach an arbitrary reporting function: