Added progress bar

This commit is contained in:
Soxoj
2021-01-01 17:35:21 +03:00
parent 320db643ed
commit 863e16b1d9
3 changed files with 9 additions and 1 deletions
+5 -1
View File
@@ -19,6 +19,7 @@ import aiohttp
from aiohttp_socks import ProxyConnector from aiohttp_socks import ProxyConnector
from python_socks import _errors as proxy_errors from python_socks import _errors as proxy_errors
import requests import requests
import tqdm.asyncio
from mock import Mock from mock import Mock
from socid_extractor import parse, extract 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) update_site_coro = update_site_data_from_response(sitename, site_data, result_obj, sem, logger, query_notify)
future = asyncio.ensure_future(update_site_coro) future = asyncio.ensure_future(update_site_coro)
tasks.append(future) tasks.append(future)
await asyncio.gather(*tasks)
for f in tqdm.asyncio.tqdm.as_completed(tasks):
await f
await session.close() await session.close()
# Notify caller that all queries are finished. # Notify caller that all queries are finished.
+3
View File
@@ -3,6 +3,8 @@
This module defines the objects for notifying the caller about the This module defines the objects for notifying the caller about the
results of queries. results of queries.
""" """
import sys
from colorama import Fore, Style, init from colorama import Fore, Style, init
from .result import QueryStatus from .result import QueryStatus
@@ -265,6 +267,7 @@ class QueryNotifyPrint(QueryNotify):
f"site '{self.result.site_name}'") f"site '{self.result.site_name}'")
if notify: if notify:
sys.stdout.write('\x1b[1K\r')
print(notify) print(notify)
return return
+1
View File
@@ -19,6 +19,7 @@ socid-extractor==0.0.2
soupsieve==2.1 soupsieve==2.1
stem==1.8.0 stem==1.8.0
torrequest==0.1.0 torrequest==0.1.0
tqdm==4.55.0
typing-extensions==3.7.4.3 typing-extensions==3.7.4.3
urllib3==1.26.2 urllib3==1.26.2
XMind==1.2.0 XMind==1.2.0