Skip to content

Commit

Permalink
fix: handle the case when the URL has a certificate error
Browse files Browse the repository at this point in the history
  • Loading branch information
Helias authored Nov 10, 2023
1 parent 49b49f9 commit 8677454
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ def get_users() -> list[str]:

async def check_ok(url: str) -> bool:
async with AsyncClient(http2=True, follow_redirects=True) as client:
r = await client.get(url)
return codes.is_success(r.status_code)

try:
r = await client.get(url)
return codes.is_success(r.status_code)
except:
return codes.is_success(404)

def check_ping(host: str) -> bool:
param = '-n' if platform.system().lower() == 'windows' else '-c'
Expand Down Expand Up @@ -88,4 +90,4 @@ def init() -> None:
main()


init()
init()

0 comments on commit 8677454

Please sign in to comment.