From 315dffc91afb75fec8804f1565548ed622fd6217 Mon Sep 17 00:00:00 2001 From: tom Date: Wed, 16 Feb 2022 23:06:05 -0500 Subject: [PATCH] added async progress bar --- twayback B/twayback.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/twayback B/twayback.py b/twayback B/twayback.py index c2317dc..8eb56e0 100644 --- a/twayback B/twayback.py +++ b/twayback B/twayback.py @@ -5,6 +5,9 @@ from pathlib import Path import simplejson as json from tqdm import tqdm as tqdm +# this import needs to be named different since we've used up tqdm above +# used for progress bar on our async operations +from tqdm.asyncio import tqdm as asyncProgress import colorama from colorama import Fore, Back, Style colorama.init(autoreset=True) @@ -37,7 +40,7 @@ async def asyncStarter(url_list): # limit to 50 concurrent jobs sem = asyncio.Semaphore(50) # launch all the url checks concurrently as coroutines - status_list = await asyncio.gather(*(checkStatus(u, session, sem) for u in url_list)) + status_list = await asyncProgress.gather(*(checkStatus(u, session, sem) for u in url_list)) # return a list of the results return status_list if platform.system() == 'Windows':