X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=solution%2Fdev%2Fclient-scripts-ves-v7%2FglobalVesEventEmitter.py;h=26c38794b8975d829c85457e48f67f4583e65559;hb=1f44a1e09401212c714c5b43e635f5c6ccf77c94;hp=fadd6c6c48ede39fa9c6434df1fe4c41235ae910;hpb=f65d13bb74fa868d0bbbefc6032c81238aa23d7c;p=oam.git diff --git a/solution/dev/client-scripts-ves-v7/globalVesEventEmitter.py b/solution/dev/client-scripts-ves-v7/globalVesEventEmitter.py index fadd6c6..26c3879 100644 --- a/solution/dev/client-scripts-ves-v7/globalVesEventEmitter.py +++ b/solution/dev/client-scripts-ves-v7/globalVesEventEmitter.py @@ -44,11 +44,12 @@ def sendVesEvent(data): except requests.exceptions.RequestException as e: # catastrophic error. bail. raise SystemExit(e) - - if response.status_code >= 200 and response.status_code < 300: + + if response.status_code >= 200 and response.status_code <= 300: print(response) else: - sys.exit('Reading VES "stndDefined" message template failed.') + print(response.status_code) + sys.exit('Sending VES "stndDefined" message template failed with code %d.' % response.status_code) def sendHttpGet(url): try: @@ -60,7 +61,7 @@ def sendHttpGet(url): except requests.exceptions.RequestException as e: # catastrophic error. bail. raise SystemExit(e) - + if response.status_code >= 200 and response.status_code < 300: return response.json() else: @@ -106,5 +107,4 @@ def saveExample(data): with open(outputFileName, 'w') as f: json.dump(data['body'], f, indent=2, sort_keys=True) else: - print("Example could not been saved:\n" + json.dump(data, f, indent=2, sort_keys=True)) - \ No newline at end of file + print("Example could not been saved:\n" + json.dump(data, f, indent=2, sort_keys=True))