"""healthcheck докера""" import json import os from urllib.request import urlopen if __name__ == "__main__": port = os.environ.get("APP_PORT", "8080") try: with urlopen(f"http://127.0.0.1:{port}/health/ready", timeout=2) as response: ready = response.status == 200 and json.load(response) == {"status": "ok"} raise SystemExit(0 if ready else 1) except (OSError, ValueError): raise SystemExit(1)