|
@@ -115,6 +115,7 @@ def parser_json_data(data):
|
|
if event_alert is None:
|
|
if event_alert is None:
|
|
continue # 如果没有 EventNotificationAlert,跳过当前记录
|
|
continue # 如果没有 EventNotificationAlert,跳过当前记录
|
|
|
|
|
|
|
|
+ ip_addr = event_alert.get("ipAddress")
|
|
iso_time = event_alert.get("dateTime")
|
|
iso_time = event_alert.get("dateTime")
|
|
dt = datetime.fromisoformat(iso_time)
|
|
dt = datetime.fromisoformat(iso_time)
|
|
dateTime = dt.strftime("%Y-%m-%d %H:%M:%S")
|
|
dateTime = dt.strftime("%Y-%m-%d %H:%M:%S")
|
|
@@ -135,7 +136,8 @@ def parser_json_data(data):
|
|
"dateTime" : dateTime,
|
|
"dateTime" : dateTime,
|
|
"pictureInfo": picture_info_list,
|
|
"pictureInfo": picture_info_list,
|
|
"VehicleInfo": VehicleInfo,
|
|
"VehicleInfo": VehicleInfo,
|
|
- "PlateInfo": PlateInfo
|
|
|
|
|
|
+ "PlateInfo": PlateInfo,
|
|
|
|
+ "ipAddress" : ip_addr
|
|
})
|
|
})
|
|
|
|
|
|
elif content_type == "image/jpeg":
|
|
elif content_type == "image/jpeg":
|
|
@@ -154,7 +156,7 @@ def parser_json_data(data):
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
if __name__ == "__main__":
|
|
- with open("tfs_0.txt", "r") as f:
|
|
|
|
|
|
+ with open("../assert/isapi_data/tfs_0.txt", "r") as f:
|
|
multipart_data = eval(f.read())
|
|
multipart_data = eval(f.read())
|
|
# print("===============", multipart_data[:3000])
|
|
# print("===============", multipart_data[:3000])
|
|
# 示例调用
|
|
# 示例调用
|
|
@@ -164,7 +166,7 @@ if __name__ == "__main__":
|
|
result = parse_multipart(multipart_data, boundary)
|
|
result = parse_multipart(multipart_data, boundary)
|
|
print(result)
|
|
print(result)
|
|
infos, images = parser_json_data(result)
|
|
infos, images = parser_json_data(result)
|
|
- print(infos, "======", images)
|
|
|
|
|
|
+ print(infos)
|
|
|
|
|
|
# with open("res.xml", "r") as f:
|
|
# with open("res.xml", "r") as f:
|
|
# xml_str = f.read()
|
|
# xml_str = f.read()
|