Bulk asynchronous downloader for multiple file hosts
Python asynciobunkrcyberdropdownloaderdropboxfilestergofilegoogle-drivemediafiremegamega-nzonedrivepatreonpawchivepinterestpixeldraintransfer-ittwitchtwittervk
refactor: ignore errors while checking for updates (#1704)
NTFSvolume4362ced790c1
diff --git a/cyberdrop_dl/__main__.py b/cyberdrop_dl/__main__.pyindex 108ebc27b..1e3a856b2 100644--- a/cyberdrop_dl/__main__.py+++ b/cyberdrop_dl/__main__.py@@ -41,7 +41,8 @@ async def _scrape(manager: Manager) -> None:stats_summary = manager.print_stats(stats)log_spacer()- await check_latest_pypi()+ async with manager.client_manager.create_aiohttp_session() as session:+ await check_latest_pypi(session)log_spacer()logger.info("Closing program...")logger.info("Finished downloading. Enjoy :)", extra={"color": "green"})diff --git a/cyberdrop_dl/updates.py b/cyberdrop_dl/updates.pyindex baaadf843..d2a6e887a 100644--- a/cyberdrop_dl/updates.py+++ b/cyberdrop_dl/updates.py@@ -11,24 +11,25 @@ _PYPI_JSON_URL = "https://pypi.org/pypi/cyberdrop-dl-patched/json"logger = logging.getLogger(__name__)-async def check_latest_pypi() -> None:+async def check_latest_pypi(session: aiohttp.ClientSession) -> None:logger.info("Checking for updates...")try:- contents = await _request_pypi_info()+ contents = await _request_pypi_info(session)except Exception as e:logger.error(f"Unable to get latest version information {e!r}")- raiseelse:_parse_pypi_resp(contents)-async def _request_pypi_info() -> dict[str, Any]:- async with aiohttp.request(- "GET",+async def _request_pypi_info(session: aiohttp.ClientSession) -> dict[str, Any]:+ async with session.get(_PYPI_JSON_URL,raise_for_status=True,- timeout=aiohttp.ClientTimeout(sock_read=30, sock_connect=20),+ timeout=aiohttp.ClientTimeout(+ sock_read=30,+ sock_connect=20,+ ),) as response:return await response.json()