#!/usr/bin/python # # pygetfile ver. 1.0 # # Download file # Usage: # pygetfile URL # # # (C) 2005 John Battles # # This file is in public domain. # user-tunable parameters: maxRetries=10 # The list of mirrors. Add new ones here. # end of user-tunable parameters import random, urllib, sys, stat, time, os, string url=sys.argv[1] outputFile = sys.argv[2] print "Getting: "+url+" saving to: "+outputFile for a in range(maxRetries): try: sys.stderr.write("Using %s\nDownloading...\n" % url) urllib.urlretrieve(url, outputFile) time.sleep(1.0) break except: pass # To tune add one sec to maxDownloadFrequencySecs = maxDownloadFrequencySecs - 1 pass