import requests
import re
import json
json_url
= 'http://192.168.172.100:23333'
while True:
conn
= requests
.get
(json_url
, stream
=True, timeout
=50)
for json_dict
in conn
.iter_lines
():
if 'frame_id' in json_dict
.decode
('utf-8'):
frame_id
= int(re
.findall
(r
"frame_id.{0,2}([0-9]+)", json_dict
.decode
('utf-8'))[0])
print('frame_id: ', frame_id
, json_dict
.decode
('utf-8'))
if len(json_dict
)>7 and 'class_id' in json_dict
.decode
('utf-8'):
json_dict
= re
.findall
(r
'{.*}', json_dict
.decode
('utf-8'))
if json_dict
:
json_dict
= json
.loads
(json_dict
[0])
else:
continue
print('the END! json_dict:{}'.format(json_dict
))
转载请注明原文地址: https://lol.8miu.com/read-28263.html