Skip to content

Bulk asynchronous downloader for multiple file hosts

Change location of raise_for_status.

Jules-WinnfieldXeb7d4b8474ba
diff --git a/utils/downloaders.py b/utils/downloaders.py
index df8b608dd..d58c5c3c0 100644
--- a/utils/downloaders.py
+++ b/utils/downloaders.py
@@ -113,7 +113,7 @@ class Downloader:
try:
async with self._semaphore:
- resp = await session.get(url, headers=headers, ssl=ssl_context)
+ resp = await session.get(url, headers=headers, ssl=ssl_context, raise_for_status=True)
total = int(resp.headers.get('Content-Length', 0)) + resume_point
with tqdm(
total=total, unit_scale=True,
@@ -188,7 +188,7 @@ class Downloader:
) -> None:
"""Download the content of all links and save them as files."""
(self.folder / self.title).mkdir(parents=True, exist_ok=True)
- async with aiohttp.ClientSession(raise_for_status=True) as session:
+ async with aiohttp.ClientSession() as session:
session.cookie_jar.update_cookies(self.morsels)
await self.download_all(self.links, session, headers=headers, show_progress=show_progress)