#!/usr/bin/env python3 import time, urllib.request for attempt in range(90): try: with urllib.request.urlopen('http://127.0.0.1:8080/health/ready',timeout=4) as r: if r.status==200: print('Ready'); break except (OSError, TimeoutError): pass time.sleep(1) else: raise SystemExit('API did not become ready')