From 85a76cd047116a488fb3c47a9f4737e5db4b714d Mon Sep 17 00:00:00 2001 From: Bla Date: Sun, 15 Oct 2023 23:34:03 +0000 Subject: [PATCH] Message handling now in queue --- server.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/server.py b/server.py index a8666ed..92ffb4d 100644 --- a/server.py +++ b/server.py @@ -28,10 +28,12 @@ def interceptor(request, response): # A response interceptor takes two args j = json.loads(i) handleJson(j) except ValueError: - print ("\nErr: ", i, "\n") if i.find("online-level") > 0: + print ("Fixed: ", i) j = json.loads(i[:i.rfind(']') + 1]) handleJson(j) + else: + print ("Err: ", i) def handleJson(jsonObj): @@ -52,8 +54,9 @@ driver.get('https://dus-travis.dus.com/') while True: sleep(1) - for i in range(1, len(q)): - a = q.popleft() - print ("[", a[3], "]: ", "NmtId: ", a[2] , " Typ: ", a[0], " Wert: ", a[1]) - + l = len(q) + for i in range(1, l): + a = q.pop() + #print ("[", a[3], "]: ", "NmtId: ", a[2] , " Typ: ", a[0], " Wert: ", a[1]) + print("Popped ",l," Messages")