Files
mtusi2026lab7/scripts/wait-ready.py
T

12 lines
402 B
Python

#!/usr/bin/env python3
import ssl,time,urllib.request
ctx=ssl.create_default_context(cafile='secrets/ca.crt')
for _ in range(90):
try:
with urllib.request.urlopen('https://localhost:8443/health/ready',context=ctx,timeout=2) as r:
if r.status==200: break
except OSError: pass
time.sleep(1)
else: raise SystemExit('HTTPS API readiness timeout')
print('HTTPS API ready with verified CA/hostname')