lab6 done
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Wait for the local gateway without disclosing application configuration."""
|
||||
import argparse
|
||||
import time
|
||||
import urllib.request
|
||||
p=argparse.ArgumentParser();p.add_argument('--base-url',default='http://localhost:18086');args=p.parse_args()
|
||||
deadline=time.monotonic()+120
|
||||
while time.monotonic()<deadline:
|
||||
try:
|
||||
with urllib.request.urlopen(args.base_url+'/health/ready',timeout=3) as response:
|
||||
if response.status==200:
|
||||
print('API is ready');break
|
||||
except Exception:
|
||||
pass
|
||||
time.sleep(1)
|
||||
else:
|
||||
raise SystemExit('API did not become ready within 120 seconds')
|
||||
Reference in New Issue
Block a user