From f46902879af8644cca4094a64947a8b755222504 Mon Sep 17 00:00:00 2001 From: tretrauit Date: Wed, 18 Jan 2023 11:45:40 +0700 Subject: [PATCH] fix: aiohttp.client_exceptions.ClientPayloadError: Response payload is not completed --- setup.py | 2 +- worthless/installer.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 632e7ef..7ac28cc 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ README = (HERE / "README.md").read_text() setup( name='worthless', - version='2.2.9', + version='2.2.10', packages=['worthless', 'worthless.classes', 'worthless.classes.launcher', 'worthless.classes.installer'], url='https://git.froggi.es/tretrauit/worthless-launcher', license='MIT License', diff --git a/worthless/installer.py b/worthless/installer.py index a87ade1..b97a94d 100644 --- a/worthless/installer.py +++ b/worthless/installer.py @@ -36,13 +36,14 @@ async def _download_file(file_url: str, file_name: str, file_path: Path | str, f else: await file_path.touch() print(f"Downloading {file_url} to {file_path}...") - async with aiohttp.ClientSession() as session: + async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=60*60, sock_read=240)) as session: rsp = await session.get(file_url, headers=headers, timeout=None) if rsp.status == 416: return rsp.raise_for_status() while True: chunk = await rsp.content.read(chunks) + await asyncio.sleep(0) if not chunk: break async with file_path.open("ab") as f: