import httpx async def ping(addr: str, token: str) -> tuple[bool, str | None]: if not addr or not token: return False, "vault addr or token empty" base = addr.rstrip("/") try: async with httpx.AsyncClient(timeout=5.0, verify=True) as client: r = await client.get( f"{base}/v1/sys/health", headers={"X-Vault-Token": token}, ) except Exception as e: return False, str(e) if r.status_code in (200, 429, 503, 501): return True, None return False, f"http {r.status_code}"