Skip to content

Instantly share code, notes, and snippets.

@douglarek
Created November 16, 2013 16:06
Show Gist options
  • Save douglarek/7501941 to your computer and use it in GitHub Desktop.
Save douglarek/7501941 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import sys
try:
import urllib.request
except ImportError:
import urllib
urllib.request = None
request = urllib.request or urllib
def reporthook(*argv):
sys.stdout.write('\r% 3.1f%% of %d bytes' % (min(100, float(argv[0] *
argv[1]) / argv[2] * 100), argv[2]))
sys.stdout.flush()
if __name__ == '__main__':
request.urlretrieve('http://git-core.googlecode.com/files/git-1.8.4.3.tar.gz',
reporthook=reporthook)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment