From 5a64ba6abb5101b3eac670a73c6078f8f4525349 Mon Sep 17 00:00:00 2001 From: Karako Date: Sat, 27 May 2023 00:37:02 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20`AssetsService`=20Adapt=20?= =?UTF-8?q?to=20HoneyImpact's=20new=20resources'=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/dependence/assets.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/dependence/assets.py b/core/dependence/assets.py index 9077eb8..2a33875 100644 --- a/core/dependence/assets.py +++ b/core/dependence/assets.py @@ -120,7 +120,10 @@ class _AssetsService(ABC): error = None for _ in range(5): try: - return await self.client.get(url, follow_redirects=False) + response = await self.client.get(url, follow_redirects=False) + if response.headers.get("content-length", None) == "2358": + continue + return response except (TransportError, SSLZeroReturnError) as e: error = e await asyncio.sleep(interval) @@ -171,7 +174,8 @@ class _AssetsService(ABC): async for url in func(item): if url is not None: try: - response = await self._request(url := str(url)) + if (response := await self._request(url := str(url))) is None: + continue response.raise_for_status() yield url except HTTPStatusError: