Esempio n. 1
0
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()
Esempio n. 2
0
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()
Esempio n. 3
0
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()