X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=solution%2Fdev%2Fclient-scripts-ves-v7%2FglobalVesEventEmitter.py;h=9f44a5c8eb76aeea39d4a59898dac52af6073881;hb=refs%2Fchanges%2F74%2F7374%2F1;hp=1824a04f636af1c0ee19eb99212cb6b13f969094;hpb=86b92e82e31a1c948dbc7c78517978aaee31a0b8;p=oam.git diff --git a/solution/dev/client-scripts-ves-v7/globalVesEventEmitter.py b/solution/dev/client-scripts-ves-v7/globalVesEventEmitter.py index 1824a04..9f44a5c 100644 --- a/solution/dev/client-scripts-ves-v7/globalVesEventEmitter.py +++ b/solution/dev/client-scripts-ves-v7/globalVesEventEmitter.py @@ -26,6 +26,7 @@ import socket import sys import yaml from pathlib import Path +from _datetime import timezone def sendVesEvent(data): url = data['config']['vesEndpoint']['url'] @@ -44,7 +45,7 @@ def sendVesEvent(data): # 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 <= 500: print(response) else: sys.exit('Reading VES "stndDefined" message template failed.') @@ -66,7 +67,7 @@ def sendHttpGet(url): sys.exit('Reading VES "stndDefined" message template failed.') def getInitData(domain, stndBody=''): - currentTime = datetime.datetime.utcnow() + currentTime = datetime.datetime.now(tz=timezone.utc) dir = os.path.dirname(os.path.realpath(__file__)) result = {} @@ -105,5 +106,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))