def download_file(url, dest=None): if dest is None: dest = urlparse(url).path.split('/')[-1] with tqdm.tqdm(unit='B', unit_scale=True, miniters=1, dynamic_ncols=True, desc=dest) as bar: dl = Download(url, dest, progress=download_progress(bar)) dl.start() dl.wait()
def download_file(url, dest=None): if dest is None: dest = urlparse(url).path.split('/')[-1] widgets = ['Download: ', Percentage(), ' ', Bar(marker=RotatingMarker()), ' ', ETA(), ' ', FileTransferSpeed()] bar = ProgressBar(widgets=widgets).start() def download_progress(_, current, total): bar.maxval = total bar.update(current) dl = Download(url, dest, progress=download_progress) dl.start() dl.wait() bar.finish()