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)
|
j = json.loads(i)
|
||||||
handleJson(j)
|
handleJson(j)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
print ("\nErr: ", i, "\n")
|
|
||||||
if i.find("online-level") > 0:
|
if i.find("online-level") > 0:
|
||||||
|
print ("Fixed: ", i)
|
||||||
j = json.loads(i[:i.rfind(']') + 1])
|
j = json.loads(i[:i.rfind(']') + 1])
|
||||||
handleJson(j)
|
handleJson(j)
|
||||||
|
else:
|
||||||
|
print ("Err: ", i)
|
||||||
|
|
||||||
|
|
||||||
def handleJson(jsonObj):
|
def handleJson(jsonObj):
|
||||||
|
@ -52,8 +54,9 @@ driver.get('https://dus-travis.dus.com/')
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
sleep(1)
|
sleep(1)
|
||||||
for i in range(1, len(q)):
|
l = len(q)
|
||||||
a = q.popleft()
|
for i in range(1, l):
|
||||||
print ("[", a[3], "]: ", "NmtId: ", a[2] , " Typ: ", a[0], " Wert: ", a[1])
|
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