in ml_service/util/smoke_test_scoring_service.py [0:0]
def call_web_app(url, headers):
# Generate an HTTP 'traceparent' distributed tracing header
# (per the W3C Trace Context proposed specification).
headers['traceparent'] = "00-{0}-{1}-00".format(
secrets.token_hex(16), secrets.token_hex(8))
retries = 600
for i in range(retries):
try:
response = requests.post(
url, json=input, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.HTTPError as e:
if i == retries - 1:
raise e
print(e)
print("Retrying...")
time.sleep(1)