Python Urllib2 Download File Progress

Posted on by  admin
Python

Download File Info

But some of these files are going to be really, really big, and I want to get a progress bar going. I've tried doing a while loop like this: Here is a little snippet that I use occassionally: - geturl.py - import os import sys import urllib def reporthook(numblocks, blocksize, filesize, url=None): #print 'reporthook(%s,%s,%s)'% (numblocks, blocksize, filesize) base = os.path.basename(url) #XXX Should handle possible filesize=-1.

UrlopenFlash

Urllib2 Get

Here's a fully working example that builds on Anurag's approach of chunking in a response.

Comments are closed.