17 lines
527 B
Python
17 lines
527 B
Python
#!/usr/bin/env python
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import sys
|
|
import urllib.error
|
|
import urllib.request
|
|
|
|
url = sys.argv[1] if len(sys.argv) > 1 else "http://127.0.0.1:8080/health/ready/"
|
|
try:
|
|
with urllib.request.urlopen(url, timeout=4) as response: # noqa: S310 - vaste interne health-URL
|
|
payload = json.load(response)
|
|
if response.status != 200 or not payload.get("ok"):
|
|
raise SystemExit(1)
|
|
except (urllib.error.URLError, ValueError, TimeoutError):
|
|
raise SystemExit(1) from None
|