How to download a file over HTTP?

One more, using urlretrieve: import urllib.request urllib.request.urlretrieve(“http://www.example.com/songs/mp3.mp3”, “mp3.mp3″) (for Python 2 use import urllib and urllib.urlretrieve) Yet another one, with a “progressbar” import urllib2 url = “http://download.thinkbroadband.com/10MB.zip” file_name = url.split(“https://stackoverflow.com/”)[-1] u = urllib2.urlopen(url) f = open(file_name, ‘wb’) meta = u.info() file_size = int(meta.getheaders(“Content-Length”)[0]) print “Downloading: %s Bytes: %s” % (file_name, file_size) file_size_dl = 0 block_sz … Read more