🐛 Fix AssetsService

Adapt to HoneyImpact's new resources' API
This commit is contained in:
Karako 2023-05-27 00:37:02 +08:00 committed by 洛水居室
parent 9aaf5fb50f
commit 5a64ba6abb
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC

View File

@ -120,7 +120,10 @@ class _AssetsService(ABC):
error = None error = None
for _ in range(5): for _ in range(5):
try: 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: except (TransportError, SSLZeroReturnError) as e:
error = e error = e
await asyncio.sleep(interval) await asyncio.sleep(interval)
@ -171,7 +174,8 @@ class _AssetsService(ABC):
async for url in func(item): async for url in func(item):
if url is not None: if url is not None:
try: try:
response = await self._request(url := str(url)) if (response := await self._request(url := str(url))) is None:
continue
response.raise_for_status() response.raise_for_status()
yield url yield url
except HTTPStatusError: except HTTPStatusError: