e
This commit is contained in:
parent
bffb4e487f
commit
00000d93a0
1 changed files with 5 additions and 2 deletions
|
|
@ -167,11 +167,14 @@ async def check_status(client: httpx.AsyncClient, url: str) -> bool:
|
|||
return r.status_code == 200
|
||||
|
||||
|
||||
async def get_base(client: httpx.AsyncClient, mirrors: list[str]) -> str:
|
||||
async def get_base(client: httpx.AsyncClient, mirrors: list[str]) -> str | None:
|
||||
tasks = [check_status(client, link) for link in mirrors]
|
||||
results = await asyncio.gather(*tasks)
|
||||
|
||||
return [url for url, ok in zip(mirrors, results) if ok][0]
|
||||
try:
|
||||
return [url for url, ok in zip(mirrors, results) if ok][0]
|
||||
except IndexError:
|
||||
return
|
||||
|
||||
|
||||
def capture_req(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue