class Download(object): def __init__(self, url, destination): self.url = url self.destination = destination self.pb = None def feedback(self, numblocks, blocksize, totalsize): if not self.pb: self.pb = Progress(totalsize) self.pb.progress(numblocks * blocksize) def download(self): cb = None if sys.stdout.isatty(): cb = self.feedback urllib.urlretrieve(self.url, self.destination, cb) if self.pb: self.pb.finish()
def feedback(self, numblocks, blocksize, totalsize): if not self.pb: self.pb = Progress(totalsize) self.pb.progress(numblocks * blocksize)
def __init__(self, globl, progress_object): BaseProgress.__init__(self, 100) self.globl = globl self.progress_object = progress_object