🐛 Fix honey request retry return type

This commit is contained in:
xtaodada 2024-04-23 21:42:27 +08:00
parent c53de16302
commit 1b36129dea
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659

View File

@ -32,15 +32,15 @@ FULL_DATA_TYPE = Dict[str, DATA_TYPE]
client = AsyncClient() client = AsyncClient()
async def request(url: str, retry: int = 5) -> Optional[Response]: async def request(url: str, retry: int = 10) -> Optional[Response]:
for time in range(retry): for time in range(retry):
try: try:
return await client.get(url) return await client.get(url)
except HTTPError: except HTTPError as e:
if time != retry - 1: if time != retry - 1:
await asyncio.sleep(1) await asyncio.sleep(1)
continue continue
return None raise e
except Exception as e: except Exception as e:
raise e raise e