添加推送等级

This commit is contained in:
quantulr
2024-03-14 11:02:52 +08:00
parent 31b4ef217b
commit 91b25dab9e
6 changed files with 321 additions and 193 deletions

View File

@ -65,6 +65,7 @@ async def read_event():
if detection_field_name in event_detail['data']:
event_detail['data']["_detectionResult"] = event_detail['data'].pop(
detection_field_name)
replace_image_host(event_detail['data']["_detectionResult"])
logging.info(event_detail)
try:
push_resp = requests.post(push_url, json=event_detail).content.decode('utf-8')
@ -93,6 +94,7 @@ async def read_event():
detection_field_name = event['data']['eventType']
if detection_field_name in event['data']:
event['data']["_detectionResult"] = event['data'].pop(detection_field_name)
replace_image_host(event['data']["_detectionResult"])
# 请求推送 api
logging.info(event)
try:
@ -108,6 +110,13 @@ async def read_event():
await asyncio.sleep(0.5)
def replace_image_host(detection_data):
if "imageUrl" in detection_data:
detection_data["imageUrl"] = detection_data["imageUrl"].replace("192.168.1.250", "192.168.11.180")
if "visiblePicUrl" in detection_data:
detection_data["visiblePicUrl"] = detection_data["visiblePicUrl"].replace("192.168.1.250", "192.168.11.180")
def run_app():
asyncio.run(read_event())