Message handling now in queue

This commit is contained in:
Bla 2023-10-15 23:34:03 +00:00
parent c2aa4c0a9e
commit 85a76cd047
1 changed files with 8 additions and 5 deletions

View File

@ -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")