updating and refactoring codebase for improved performance and maintainability
This commit is contained in:
@@ -2,8 +2,6 @@ from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
import httpx
|
||||
|
||||
from SYS.result_table import Table
|
||||
|
||||
|
||||
@@ -68,9 +66,10 @@ def ping_url(url: str, timeout: float = 3.0) -> tuple[bool, str]:
|
||||
code = int(getattr(response, "status_code", 0) or 0)
|
||||
ok = 200 <= code < 500
|
||||
return ok, f"{url} (HTTP {code})"
|
||||
except httpx.TimeoutException:
|
||||
return False, f"{url} (timeout)"
|
||||
except Exception as exc:
|
||||
import httpx as _httpx
|
||||
if isinstance(exc, _httpx.TimeoutException):
|
||||
return False, f"{url} (timeout)"
|
||||
return False, f"{url} ({type(exc).__name__})"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user