-
Notifications
You must be signed in to change notification settings - Fork 0
/
responseviewer.py
34 lines (24 loc) · 973 Bytes
/
responseviewer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import argparse
import time
import json
import requests
from Python_backend.pylibrnp.rnppacket import RnpPacket
from pylibrnp.rnppacket import RnpHeader
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--id", required=True, help="Client ID", type=str)
ap.add_argument("-a",'--address', required=False,help="ip address",type=str,default='localhost')
ap.add_argument("-p",'--port',required=False,help='port',type=str,default=1337)
args = vars(ap.parse_args())
url = "http://" + args["address"] +":" + str(args["port"]) + "/response?clientid="+args['id']
prevtime = 0
checkDelta = .5
if __name__ == '__main__':
while True:
if (time.time() - prevtime > checkDelta):
prevtime=time.time()
r = requests.get(url)
if (r.status_code is 200 and r.text != "NODATA"):
data = r.content
print(data)
head = RnpPacket.from_bytes(data)
print(head)