mirror of
https://github.com/PaiGramTeam/PaiGram.git
synced 2024-11-22 07:07:46 +00:00
🐛 Fix honey request retry return type
This commit is contained in:
parent
c53de16302
commit
1b36129dea
@ -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
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user