From b6e11f148f7faa2b82924657ee81fef8e6b803f3 Mon Sep 17 00:00:00 2001 From: Guy Van Sanden Date: Tue, 18 Feb 2025 14:46:42 +0100 Subject: [PATCH] add debug --- server/src/notifier.py | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/server/src/notifier.py b/server/src/notifier.py index 3ff951f..4c9bc93 100644 --- a/server/src/notifier.py +++ b/server/src/notifier.py @@ -36,25 +36,29 @@ def sendsmpmessage(target, message): responsejson = ws.recv() # Receive response response = json.loads(responsejson) # ws.close() + if response is not None: + return True + else: + return False - for chatitem in response['resp']['chatItems']: - statusdict = chatitem['chatItem']['meta']['itemStatus'] - try: - status = statusdict['sndProgress'] - except KeyError: - pprint(response['resp']['chatItems']) - print('---') - pprint(chatitem) - print("FAILED") - status = 'FAILED' - else: - smessage = chatitem['chatItem']['meta']['itemText'] - print("Message '%s' sent over websocket to %s, status was %s" % (smessage, target, status)) + # for chatitem in response['resp']['chatItems']: + # statusdict = chatitem['chatItem']['meta']['itemStatus'] + # try: + # status = statusdict['sndProgress'] + # except KeyError: + # pprint(response['resp']['chatItems']) + # print('---') + # pprint(chatitem) + # print("FAILED") + # status = 'FAILED' + # else: + # smessage = chatitem['chatItem']['meta']['itemText'] + # print("Message '%s' sent over websocket to %s, status was %s" % (smessage, target, status)) - if status == 'complete' or status == 'partial': - return True - else: - return False + # if status == 'complete' or status == 'partial': + # return True + # else: + # return False if __name__ == '__main__':