fix: aiohttp.client_exceptions.ClientPayloadError: Response payload is not completed
This commit is contained in:
parent
95dccf7241
commit
f46902879a
2
setup.py
2
setup.py
@ -10,7 +10,7 @@ README = (HERE / "README.md").read_text()
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='worthless',
|
name='worthless',
|
||||||
version='2.2.9',
|
version='2.2.10',
|
||||||
packages=['worthless', 'worthless.classes', 'worthless.classes.launcher', 'worthless.classes.installer'],
|
packages=['worthless', 'worthless.classes', 'worthless.classes.launcher', 'worthless.classes.installer'],
|
||||||
url='https://git.froggi.es/tretrauit/worthless-launcher',
|
url='https://git.froggi.es/tretrauit/worthless-launcher',
|
||||||
license='MIT License',
|
license='MIT License',
|
||||||
|
@ -36,13 +36,14 @@ async def _download_file(file_url: str, file_name: str, file_path: Path | str, f
|
|||||||
else:
|
else:
|
||||||
await file_path.touch()
|
await file_path.touch()
|
||||||
print(f"Downloading {file_url} to {file_path}...")
|
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)
|
rsp = await session.get(file_url, headers=headers, timeout=None)
|
||||||
if rsp.status == 416:
|
if rsp.status == 416:
|
||||||
return
|
return
|
||||||
rsp.raise_for_status()
|
rsp.raise_for_status()
|
||||||
while True:
|
while True:
|
||||||
chunk = await rsp.content.read(chunks)
|
chunk = await rsp.content.read(chunks)
|
||||||
|
await asyncio.sleep(0)
|
||||||
if not chunk:
|
if not chunk:
|
||||||
break
|
break
|
||||||
async with file_path.open("ab") as f:
|
async with file_path.open("ab") as f:
|
||||||
|
Loading…
Reference in New Issue
Block a user