From a67d0251b6d7a2564ce8e0c7257ca3b382f316a8 Mon Sep 17 00:00:00 2001 From: zqc <835569504@qq.com> Date: Mon, 2 Feb 2026 10:55:27 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=B0=E5=BB=8A=E6=96=B0=E5=A2=9E=E5=8F=91?= =?UTF-8?q?=E9=80=81post=E8=AF=B7=E6=B1=82=E7=BB=99=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rtsp_service_ws_Zoulang.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/rtsp_service_ws_Zoulang.py b/rtsp_service_ws_Zoulang.py index 345e9e7..5b666f3 100644 --- a/rtsp_service_ws_Zoulang.py +++ b/rtsp_service_ws_Zoulang.py @@ -13,6 +13,7 @@ import json import base64 import asyncio import websockets +import requests from dataclasses import dataclass from typing import Dict, Any, Tuple, List from datetime import datetime @@ -28,10 +29,10 @@ from yolox.tracker.byte_tracker import BYTETracker # Kadian 模型路径与ROI(可根据实际情况修改) detector_model_path = 'YOLO_Weight/prisoner_model.onnx' - +ALERT_PUSH_URL = "http://123.57.151.210:10000/picenter/websocket/test/process" # 输入尺寸 -input_size = 640 +input_size = 1280 # RTSP 服务配置 RTSP_TARGET_FPS = 10.0 @@ -687,6 +688,17 @@ class FrameProcessorWorker(threading.Thread): #if action_names and len(action_names) > 0: if push_actions and len(push_actions) > 0: self.ws_queue_2.put(msg, timeout=1.0) + # 发送POST请求 + post_msg = msg.copy() + post_msg['type'] = 2 + try: + response = requests.post(ALERT_PUSH_URL, json=post_msg, timeout=5.0) + if response.status_code == 200: + print(f"[INFO] POST alert sent successfully for actions: {push_actions}") + else: + print(f"[WARN] POST alert failed with status: {response.status_code}") + except Exception as e: + print(f"[ERROR] POST alert request failed: {e}") except queue.Full: print("[WARN] ws_send_queue full, drop frame message")