#!/usr/bin/env python3 import os import time import urllib.request url = os.getenv('BASE_URL', 'http://localhost:8080') + '/health/ready' deadline = time.monotonic() + 90 while True: try: with urllib.request.urlopen(url, timeout=2) as response: if response.status == 200: print('PASS: LB readiness') break except OSError: pass if time.monotonic() >= deadline: raise SystemExit('Readiness timeout') time.sleep(0.5)