Message handling now in queue
This commit is contained in:
parent
c2aa4c0a9e
commit
85a76cd047
13
server.py
13
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")
|
||||
|
||||
|
|
Loading…
Reference in a new issue