diff --git a/maigret/maigret.py b/maigret/maigret.py index 003df7b..0d8f07c 100755 --- a/maigret/maigret.py +++ b/maigret/maigret.py @@ -19,6 +19,7 @@ import aiohttp from aiohttp_socks import ProxyConnector from python_socks import _errors as proxy_errors import requests +import tqdm.asyncio from mock import Mock from socid_extractor import parse, extract @@ -467,7 +468,10 @@ async def maigret(username, site_data, query_notify, logger, update_site_coro = update_site_data_from_response(sitename, site_data, result_obj, sem, logger, query_notify) future = asyncio.ensure_future(update_site_coro) tasks.append(future) - await asyncio.gather(*tasks) + + for f in tqdm.asyncio.tqdm.as_completed(tasks): + await f + await session.close() # Notify caller that all queries are finished. diff --git a/maigret/notify.py b/maigret/notify.py index 97325c9..4dc87dc 100644 --- a/maigret/notify.py +++ b/maigret/notify.py @@ -3,6 +3,8 @@ This module defines the objects for notifying the caller about the results of queries. """ +import sys + from colorama import Fore, Style, init from .result import QueryStatus @@ -265,6 +267,7 @@ class QueryNotifyPrint(QueryNotify): f"site '{self.result.site_name}'") if notify: + sys.stdout.write('\x1b[1K\r') print(notify) return diff --git a/requirements.txt b/requirements.txt index 6f893e6..364188a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -19,6 +19,7 @@ socid-extractor==0.0.2 soupsieve==2.1 stem==1.8.0 torrequest==0.1.0 +tqdm==4.55.0 typing-extensions==3.7.4.3 urllib3==1.26.2 XMind==1.2.0