2020-09-29 21:30:48 -07:00
|
|
|
#!/usr/bin/env python3
|
2021-11-08 06:51:57 -08:00
|
|
|
import sys, json, argparse
|
|
|
|
|
|
|
|
parser = argparse.ArgumentParser()
|
|
|
|
parser.add_argument("--empty_error", action="store_true", help="If present, do not print error message")
|
|
|
|
args = parser.parse_args()
|
2018-10-09 10:35:01 -07:00
|
|
|
|
|
|
|
data=json.load(sys.stdin)
|
2019-10-21 17:00:17 -07:00
|
|
|
|
|
|
|
if 'results' in data:
|
|
|
|
for result in data['results']:
|
2019-10-23 10:04:15 -07:00
|
|
|
if 'series' in result:
|
2021-10-06 16:59:08 -07:00
|
|
|
print(result['series'][0]['columns'][1] + ': ' + str(result['series'][0]['values'][0][1]))
|
2021-11-08 06:51:57 -08:00
|
|
|
elif not args.empty_error:
|
2020-09-29 21:30:48 -07:00
|
|
|
print("An expected result from CURL request is missing")
|
2021-11-08 06:51:57 -08:00
|
|
|
elif not args.empty_error:
|
2020-09-29 21:30:48 -07:00
|
|
|
print("No results returned from CURL request")
|