{"id":87431,"date":"2026-07-30T09:48:23","date_gmt":"2026-07-30T01:48:23","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/87431.html"},"modified":"2026-07-30T09:48:23","modified_gmt":"2026-07-30T01:48:23","slug":"%e3%80%8a%e6%9c%ba%e6%88%bf%e8%bf%90%e7%bb%b4%e8%87%aa%e6%95%91%e6%8c%87%e5%8d%97%ef%bc%9a%e5%a6%82%e4%bd%95%e5%88%a9%e7%94%a8-python-%e5%b1%80%e5%9f%9f%e7%bd%91-webhook-%e6%90%ad%e5%bb%ba%e4%b8%80","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/87431.html","title":{"rendered":"\u300a\u673a\u623f\u8fd0\u7ef4\u81ea\u6551\u6307\u5357\uff1a\u5982\u4f55\u5229\u7528 Python + \u5c40\u57df\u7f51 WebHook \u642d\u5efa\u4e00\u5957\u7269\u7406\u7ea7\u201c\u58f0\u5149\u201d\u9632\u6f0f\u62a5\u544a\u8b66\u7cfb\u7edf\u300b"},"content":{"rendered":"<h5>\u4e00\u3001 \u80cc\u666f&#xff1a;\u5f53\u8fd0\u7ef4\u5f00\u59cb\u5bf9\u201c\u9489\u9489\/\u90ae\u4ef6\u544a\u8b66\u201d\u4ea7\u751f\u514d\u75ab<\/h5>\n<p>\u4f5c\u4e3a\u8fd0\u7ef4\u6216\u540e\u7aef\u5f00\u53d1&#xff0c;\u5927\u5bb6\u4e00\u5b9a\u9047\u5230\u8fc7\u8fd9\u79cd\u573a\u666f&#xff1a;\u76d1\u63a7\u5e73\u53f0\u4e0a\u914d\u7f6e\u4e86\u5bc6\u5bc6\u9ebb\u9ebb\u7684\u544a\u8b66\u89c4\u5219&#xff08;Prometheus \/ Zabbix \/ Grafana&#xff09;&#xff0c;\u6bcf\u5929\u4f01\u4e1a\u5fae\u4fe1\u3001\u9489\u9489\u7fa4\u6216\u8005\u90ae\u7bb1\u91cc\u80fd\u6536\u5230\u5927\u51e0\u767e\u6761\u901a\u77e5\u3002<\/p>\n<p>\u65f6\u95f4\u4e00\u957f&#xff0c;\u4eba\u8111\u5c31\u4f1a\u81ea\u52a8\u4ea7\u751f\u201c\u544a\u8b66\u514d\u75ab\u201d\u3002\u6709\u51e0\u6b21\u6838\u5fc3\u4ea4\u6362\u673a\u51fa\u73b0\u5076\u53d1\u6027\u4e22\u5305\u3001\u6216\u8005\u6570\u636e\u5e93\u524d\u7f6e\u673a\u5185\u5b58\u6ea2\u51fa&#xff0c;\u9ad8\u5371\u544a\u8b66\u76f4\u63a5\u88ab\u6df9\u6ca1\u5728\u4e86\u5bc6\u5bc6\u9ebb\u9ebb\u7684\u65e5\u5e38\u901a\u77e5\u91cc&#xff0c;\u5bfc\u81f4\u6574\u6574\u534a\u5c0f\u65f6\u540e\u624d\u6709\u4eba\u63a5\u5165\u6392\u67e5\u3002<\/p>\n<p>\u7ebf\u4e0a\u63a8\u9001\u5f88\u5bb9\u6613\u88ab\u5ffd\u7565&#xff0c;\u4f46\u5728\u7269\u7406\u73b0\u573a&#xff0c;\u201c\u58f0\u97f3\u548c\u5149\u7ebf\u201d\u662f\u65e0\u6cd5\u88ab\u514d\u75ab\u7684\u3002\u4e3a\u4e86\u5f7b\u5e95\u89e3\u51b3\u9ad8\u5371\u6545\u969c\u6f0f\u62a5\u7684\u95ee\u9898&#xff0c;\u6211\u4eec\u56e2\u961f\u5728\u6700\u8fd1\u7684\u673a\u623f\u5347\u7ea7\u4e2d&#xff0c;\u51b3\u5b9a\u81ea\u5efa\u4e00\u5957\u201c\u7269\u7406\u5c42\u9762\u7684\u58f0\u5149\u8054\u52a8\u544a\u8b66\u673a\u5236\u201d\u2014\u2014\u901a\u8fc7\u5c40\u57df\u7f51\u5185\u7684\u786c\u4ef6\u7f51\u5173&#xff0c;\u628a\u6570\u5b57\u544a\u8b66\u76f4\u63a5\u53d8\u6210\u673a\u623f\u91cc\u7684 \u5168\u5f69 LED \u95ea\u70c1 \u548c TTS&#xff08;\u6587\u672c\u8f6c\u8bed\u97f3&#xff09;\u771f\u4eba\u9ad8\u5206\u8d1d\u64ad\u62a5\u3002<\/p>\n<h5>\u4e8c\u3001 \u7cfb\u7edf\u67b6\u6784&#xff1a;\u57fa\u4e8e REST API \u7684\u65e0\u4fb5\u5165\u5f0f\u8bbe\u8ba1<\/h5>\n<p>\u5728\u8bbe\u8ba1\u8fd9\u5957\u8f6f\u786c\u4ef6\u8054\u52a8\u65b9\u6848\u65f6&#xff0c;\u4e3a\u4e86\u4fdd\u8bc1\u673a\u623f\u5f31\u7535\u73af\u5883\u7684\u5b89\u5168&#xff0c;\u4ee5\u53ca\u964d\u4f4e\u4e1a\u52a1\u7cfb\u7edf\u7684\u8026\u5408\u5ea6&#xff0c;\u6211\u4eec\u62d2\u7edd\u4e86\u590d\u6742\u7684\u5de5\u4e1a PLC \u7ec4\u6001\u903b\u8f91&#xff0c;\u800c\u662f\u91c7\u7528\u4e86\u73b0\u4ee3 Web \u5f00\u53d1\u6700\u719f\u6089\u7684 RESTful HTTP API \u5f02\u6b65\u89e3\u8026\u67b6\u6784\u3002<\/p>\n<p>\u6838\u5fc3\u901a\u4fe1\u903b\u8f91&#xff1a;<\/p>\n<li>\n<p>\u8fb9\u7f18\u4e3b\u52a8\u63a2\u6d4b&#xff1a;\u544a\u8b66\u7f51\u5173\u672c\u8eab\u4f5c\u4e3a\u72ec\u7acb\u8282\u70b9&#xff0c;\u901a\u8fc7\u5185\u7f6e\u7684 ICMP&#xff08;Ping&#xff09;\u3001HTTP \u72b6\u6001\u7801&#xff08;200\/500&#xff09;\u4ee5\u53ca SNMP \u534f\u8bae&#xff0c;\u4e3b\u52a8\u8f6e\u8be2\u5185\u7f51\u7684\u6838\u5fc3\u4ea4\u6362\u673a\u548c\u670d\u52a1\u5668\u72b6\u6001\u3002<\/p>\n<\/li>\n<li>\n<p>\u4e0a\u5c42 WebHook \u89e6\u53d1&#xff1a;\u5f53\u73b0\u6709\u7684\u76d1\u63a7\u5e73\u53f0&#xff08;\u5982 Grafana \u89e6\u53d1\u5668&#xff09;\u68c0\u6d4b\u5230\u670d\u52a1\u6302\u6389\u65f6&#xff0c;\u5f02\u6b65\u5411\u544a\u8b66\u7f51\u5173\u53d1\u9001\u4e00\u4e2a\u6807\u51c6 POST \u8bf7\u6c42\u3002<\/p>\n<\/li>\n<li>\n<p>\u786c\u4ef6\u6267\u884c\u5355\u5143&#xff1a;\u7f51\u5173\u6536\u5230 JSON \u6570\u636e\u540e&#xff0c;\u5176\u5185\u7f6e\u7684\u8bed\u97f3\u5408\u6210\u82af\u7247&#xff08;TTS&#xff09;\u5c06\u6587\u672c\u8f6c\u5316\u4e3a\u8bed\u97f3&#xff0c;\u540c\u65f6\u63a7\u5236\u677f\u9a71\u52a8\u5916\u56f4\u7684\u5168\u5f69 LED \u706f\u5e26\u3002<\/p>\n<\/li>\n<p>\u8fd9\u79cd\u8bbe\u8ba1\u6700\u5927\u7684\u597d\u5904\u662f\u201c\u53cc\u5411\u95ed\u73af\u201d&#xff1a;\u65e2\u80fd\u88ab\u52a8\u63a5\u53d7\u4e1a\u52a1\u7cfb\u7edf\u7684\u63a7\u5236&#xff0c;\u4e5f\u80fd\u5728\u5168\u7f51\u65ad\u7f51\u3001\u4e0a\u5c42\u76d1\u63a7\u762b\u75ea\u65f6&#xff0c;\u901a\u8fc7\u81ea\u8eab\u7684 Ping \u63a2\u6d4b\u5b8c\u6210\u672c\u5730\u72ec\u7acb\u58f0\u5149\u544a\u8b66\u3002<\/p>\n<h5>\u4e09\u3001 \u6838\u5fc3\u4ee3\u7801\u5b9e\u73b0&#xff08;Python \u4e0e\u5185\u7f51\u63a5\u53e3\u5bf9\u63a5&#xff09;<\/h5>\n<p>\u4e3a\u4e86\u5b9e\u73b0\u65e0\u4fb5\u5165\u5f0f\u4fee\u6539&#xff0c;\u6211\u4eec\u5728\u4e2d\u95f4\u4ef6&#xff08;\u6216\u7f51\u5173\u5c42&#xff09;\u7f16\u5199\u4e86\u4e00\u6bb5 Python \u811a\u672c\u3002\u8be5\u811a\u672c\u8d1f\u8d23\u6293\u53d6\u4e0a\u6e38\u7684\u62a5\u9519\u4fe1\u606f&#xff0c;\u8fdb\u884c\u9632\u6296\u4e0e\u8282\u6d41&#xff08;Throttling&#xff09;\u5904\u7406&#xff0c;\u7136\u540e\u5229\u7528\u6807\u51c6\u7684 requests \u5e93\u9a71\u52a8\u5c40\u57df\u7f51\u5185\u7684\u58f0\u5149\u64ad\u62a5\u63a5\u53e3\u3002<\/p>\n<p>\u4ee5\u4e0b\u662f\u6211\u4eec\u5728\u751f\u4ea7\u73af\u5883\u4e2d\u5b9e\u9645\u8fd0\u884c\u7684\u6838\u5fc3\u903b\u8f91\u4ee3\u7801&#xff1a;<\/p>\n<p>Python<\/p>\n<\/p>\n<p>import requests<br \/>\nimport json<br \/>\nimport time<\/p>\n<p># \u5c40\u90e8\u7f51\u58f0\u5149\u7f51\u5173\u7684\u901a\u4fe1\u914d\u7f6e<br \/>\nALARM_GATEWAY_IP &#061; &#034;192.168.10.25&#034;  # \u5c40\u57df\u7f51\u5185\u56fa\u5b9a\u9759\u6001 IP<br \/>\nINTERFACE_URL &#061; f&#034;http:\/\/{ALARM_GATEWAY_IP}\/api\/v1\/send_msg&#034;<\/p>\n<p># \u5168\u5c40\u53d8\u91cf&#xff1a;\u7528\u4e8e\u9632\u8303\u544a\u8b66\u98ce\u66b4\u7684\u8282\u6d41\u65f6\u95f4\u6233<br \/>\nLAST_ALARM_TIMESTAMP &#061; 0<br \/>\nTHROTTLE_INTERVAL &#061; 45  # \u540c\u4e00\u7c7b\u544a\u8b6645\u79d2\u5185\u53ea\u5141\u8bb8\u73b0\u573a\u64ad\u62a5\u4e00\u6b21&#xff0c;\u9632\u6b62\u53d8\u6210\u201c\u590d\u8bfb\u673a\u201d<\/p>\n<p>def send_physical_alarm(alarm_text, severity&#061;&#034;warning&#034;):<br \/>\n    global LAST_ALARM_TIMESTAMP<br \/>\n    current_time &#061; time.time()<\/p>\n<p>    # 1. \u8282\u6d41\u5224\u65ad&#xff0c;\u9632\u6b62\u4e0a\u6e38\u7cfb\u7edf\u7a81\u53d1\u6210\u767e\u4e0a\u5343\u6761\u62a5\u9519\u5bfc\u81f4\u786c\u4ef6\u6b7b\u673a<br \/>\n    if current_time &#8211; LAST_ALARM_TIMESTAMP &lt; THROTTLE_INTERVAL:<br \/>\n        print(&#034;[INFO] \u544a\u8b66\u89e6\u53d1\u8fc7\u4e8e\u9891\u7e41&#xff0c;\u672c\u5730\u8282\u6d41\u5668\u5df2\u62e6\u622a\u7269\u7406\u64ad\u62a5\u3002&#034;)<br \/>\n        return False<\/p>\n<p>    # 2. \u6839\u636e\u6545\u969c\u4e25\u91cd\u7a0b\u5ea6&#xff0c;\u52a8\u6001\u6620\u5c04\u73b0\u573a\u7684 LED \u989c\u8272\u4e0e\u97f3\u91cf\u5927\u5c0f<br \/>\n    if severity &#061;&#061; &#034;critical&#034;:<br \/>\n        led_color &#061; &#034;#FF0000&#034;  # \u7ea2\u8272\u9ad8\u5371\u95ea\u70c1<br \/>\n        play_mode &#061; &#034;cycle&#034;    # \u5faa\u73af\u64ad\u62a5<br \/>\n        volume &#061; 90<br \/>\n    else:<br \/>\n        led_color &#061; &#034;#FFFF00&#034;  # \u9ec4\u8272\u8b66\u544a<br \/>\n        play_mode &#061; &#034;once&#034;     # \u5355\u6b21\u64ad\u62a5<br \/>\n        volume &#061; 70<\/p>\n<p>    # 3. \u6784\u9020\u7f51\u5173\u8bc6\u522b\u7684\u6807\u51c6 JSON \u8f7d\u8377<br \/>\n    payload &#061; {<br \/>\n        &#034;text&#034;: alarm_text,          # \u89e6\u53d1\u5185\u90e8 TTS \u8bed\u97f3\u5408\u6210\u82af\u7247<br \/>\n        &#034;led_color&#034;: led_color,      # \u63a7\u5236\u5168\u5f69\u706f\u5e26\u989c\u8272<br \/>\n        &#034;play_mode&#034;: play_mode,<br \/>\n        &#034;volume&#034;: volume,<br \/>\n        &#034;network_type&#034;: &#034;rj45&#034;       # \u6307\u5b9a\u4f7f\u7528\u6709\u7ebf\u7f51\u7edc\u63a5\u5165\u907f\u514dWi-Fi\u6296\u52a8<br \/>\n    }<\/p>\n<p>    headers &#061; {<br \/>\n        &#034;Content-Type&#034;: &#034;application\/json&#034;<br \/>\n    }<\/p>\n<p>    try:<br \/>\n        # \u53d1\u8d77\u5f02\u6b65\u6216\u9ad8\u8d85\u65f6\u5bb9\u9519\u7684 POST \u8bf7\u6c42<br \/>\n        response &#061; requests.post(INTERFACE_URL, data&#061;json.dumps(payload), headers&#061;headers, timeout&#061;3.5)<br \/>\n        if response.status_code &#061;&#061; 200:<br \/>\n            print(f&#034;[SUCCESS] \u7269\u7406\u58f0\u5149\u544a\u8b66\u6210\u529f\u540c\u6b65\u81f3\u73b0\u573a: {alarm_text}&#034;)<br \/>\n            LAST_ALARM_TIMESTAMP &#061; current_time<br \/>\n            return True<br \/>\n        else:<br \/>\n            print(f&#034;[ERROR] \u7f51\u5173\u62d2\u7edd\u8bf7\u6c42&#xff0c;HTTP \u72b6\u6001\u7801: {response.status_code}&#034;)<br \/>\n    except requests.exceptions.Timeout:<br \/>\n        print(&#034;[ERROR] \u8fde\u63a5\u7269\u7406\u7f51\u5173\u8d85\u65f6&#xff0c;\u8bf7\u68c0\u67e5 OOB&#xff08;\u5e26\u5916\u7ba1\u7406\u7f51&#xff09;\u94fe\u8def\u3002&#034;)<br \/>\n    except Exception as e:<br \/>\n        print(f&#034;[ERROR] \u53d1\u751f\u672a\u77e5\u7f51\u7edc\u5f02\u5e38: {e}&#034;)<\/p>\n<p>    return False<\/p>\n<p># \u6a21\u62df&#xff1a;\u6838\u5fc3\u6570\u636e\u5e93\u8fde\u63a5\u6c60\u7206\u6ee1\u65f6\u7684\u81ea\u52a8\u5316\u8054\u52a8<br \/>\nif __name__ &#061;&#061; &#034;__main__&#034;:<br \/>\n    error_log &#061; &#034;\u8b66\u544a&#xff1a;\u4e3b\u6570\u636e\u5e93\u96c6\u7fa4 3\u53f7\u8282\u70b9\u8fde\u63a5\u6c60\u5360\u7528\u7387\u8d85\u8fc7 95%&#xff0c;\u8bf7\u7acb\u5373\u5904\u7406\u3002&#034;<br \/>\n    send_physical_alarm(error_log, severity&#061;&#034;critical&#034;)<\/p>\n<h5>\u56db\u3001 \u5b9e\u9645\u90e8\u7f72\u4e2d\u9762\u4e34\u7684\u6280\u672f\u8e29\u5751\u4e0e\u5b89\u5168\u89c4\u907f<\/h5>\n<p>\u5728\u5c06\u8fd9\u5957\u5c40\u57df\u7f51\u58f0\u5149\u7cfb\u7edf\u843d\u5730\u5230\u7269\u7406\u673a\u623f\u7684\u8fc7\u7a0b\u4e2d&#xff0c;\u6211\u4eec\u8e29\u8fc7\u4e86\u4e24\u4e2a\u6bd4\u8f83\u660e\u663e\u7684\u6df1\u5751&#xff0c;\u5206\u4eab\u51fa\u6765\u4f9b\u5927\u5bb6\u53c2\u8003&#xff1a;<\/p>\n<h6>1. \u7f51\u7edc\u57df\u9694\u79bb&#xff08;\u5b89\u5168\u81f3\u4e0a&#xff09;<\/h6>\n<p>\u7531\u4e8e\u8fd9\u7c7b\u58f0\u5149\u786c\u4ef6\u901a\u5e38\u662f\u901a\u8fc7\u6807\u51c6\u7684 HTTP \u66b4\u9732\u63a5\u53e3&#xff0c;\u5982\u679c\u7f3a\u4e4f\u8db3\u591f\u7684\u53cd\u5411\u4ee3\u7406\u6216\u8eab\u4efd\u6821\u9a8c&#xff0c;\u6781\u6613\u5728\u5185\u7f51\u88ab\u6076\u610f\u6ee5\u7528&#xff08;\u6bd4\u5982\u88ab\u4eba\u6076\u610f\u8c03\u7528\u63a5\u53e3\u5927\u58f0\u64ad\u653e\u5947\u602a\u7684\u8bed\u97f3&#xff09;\u3002<\/p>\n<ul>\n<li>\n<p>\u89e3\u51b3\u65b9\u6848&#xff1a;\u4e0d\u8981\u5c06\u786c\u4ef6\u76f4\u63a5\u6302\u5728\u666e\u901a\u7684\u529e\u516c\u7f51\u7edc\u6216\u4e1a\u52a1\u7f51\u7edc&#xff08;VLAN&#xff09;\u3002\u6211\u4eec\u5728\u6838\u5fc3\u4ea4\u6362\u673a\u4e0a\u505a\u4e86 ACL&#xff08;\u8bbf\u95ee\u63a7\u5236\u5217\u8868&#xff09;&#xff0c;\u5f3a\u5236\u5c06\u58f0\u5149\u7f51\u5173\u5212\u5206\u5230\u72ec\u7acb\u7684 OOB&#xff08;\u5e26\u5916\u7ba1\u7406\u7f51&#xff09;\u4e2d\u3002\u53ea\u6709\u8fd0\u7ef4\u524d\u7f6e\u673a\u3001\u7279\u5b9a\u7684\u81ea\u52a8\u5316\u670d\u52a1\u5668\u6709\u6743\u5411\u8be5 IP \u53d1\u8d77 POST \u8bf7\u6c42\u3002<\/p>\n<\/li>\n<\/ul>\n<h6>2. \u5f31\u7535\u73af\u5883\u4e0b\u7684\u6709\u7ebf\u4e0e\u65e0\u7ebf\u9009\u578b<\/h6>\n<p>\u5927\u90e8\u5206\u5c40\u57df\u7f51\u7f51\u5173\u652f\u6301\u6709\u7ebf RJ45 \u63a5\u5165\u548c Wi-Fi \u63a5\u5165\u3002<\/p>\n<ul>\n<li>\n<p>\u907f\u5751\u6307\u5357&#xff1a;\u5728\u5bc6\u95ed\u7684\u5f31\u7535\u7bb1\u6216\u673a\u623f\u73af\u5883\u5185&#xff0c;\u5404\u79cd\u9ad8\u9891\u8bbe\u5907\u7684\u7535\u78c1\u5e72\u6270\u6781\u5176\u4e25\u91cd&#xff0c;2.4G\/5G \u7684 Wi-Fi \u4e22\u5305\u7387\u5f80\u5f80\u4f1a\u98d9\u5347&#xff0c;\u5bfc\u81f4\u544a\u8b66\u5ef6\u8fdf\u3002\u5728\u751f\u4ea7\u73af\u5883\u90e8\u7f72\u65f6&#xff0c;\u52a1\u5fc5\u901a\u8fc7\u6709\u7ebf\u7f51\u7edc\u63a5\u5165&#xff0c;\u5e76\u5728\u7f51\u5173\u7ba1\u7406\u540e\u53f0\u4e2d\u5173\u95ed DHCP&#xff0c;\u624b\u52a8\u4e3a\u5176\u7ed1\u5b9a\u9759\u6001 IP\u3002<\/p>\n<\/li>\n<\/ul>\n<h6>3. \u81ea\u5b9a\u4e49\u544a\u8b66\u7684\u9632\u6296\u9632\u566a<\/h6>\n<p>\u5982\u679c\u4e0a\u6e38\u662f\u8bf8\u5982\u5fae\u670d\u52a1\u7f51\u5173\u7684\u6838\u5fc3\u7ec4\u4ef6&#xff0c;\u4e00\u65e6\u96ea\u5d29\u4f1a\u77ac\u95f4\u4ea7\u751f\u51e0\u4e07\u6761\u76f8\u540c\u7684\u62a5\u9519\u65e5\u5fd7\u3002\u5982\u679c\u4e0d\u52a0\u9650\u5236&#xff0c;\u786c\u4ef6\u7f51\u5173\u4f1a\u53d1\u751f\u5185\u5b58\u6ea2\u51fa&#xff08;OOM&#xff09;\u6216\u8005\u53d1\u751f\u957f\u8fbe\u6570\u5c0f\u65f6\u7684\u201c\u544a\u8b66\u590d\u8bfb\u201d\u3002\u9664\u4e86\u5728 Python \u4ee3\u7801\u4e2d\u52a0 THROTTLE&#xff08;\u8282\u6d41&#xff09;\u4e4b\u5916&#xff0c;\u8fd8\u5e94\u5584\u7528\u7f51\u5173\u7ba1\u7406\u540e\u53f0\u81ea\u5e26\u7684\u201c\u91cd\u590d\u6570\u636e\u8fc7\u6ee4\u673a\u5236\u201d&#xff0c;\u53cc\u91cd\u4fdd\u969c\u5176\u786c\u4ef6\u7a33\u5b9a\u6027\u3002<\/p>\n<h5>\u4e94\u3001 \u603b\u7ed3<\/h5>\n<p>\u901a\u8fc7\u73b0\u4ee3 Web API \u7684\u65b9\u5f0f\u6765\u9a71\u52a8\u4f20\u7edf\u7684\u7269\u7406\u786c\u4ef6&#xff0c;\u7ed9\u6211\u4eec\u7684\u8f7b\u91cf\u5316\u8fd0\u7ef4\u6253\u5f00\u4e86\u65b0\u601d\u8def\u3002\u6211\u4eec\u4e0d\u9700\u8981\u82b1\u8d39\u6781\u9ad8\u7684\u4ee3\u4ef7\u53bb\u91cd\u6784\u5f31\u7535\u63a7\u5236\u7cfb\u7edf&#xff0c;\u4ec5\u4ec5\u901a\u8fc7\u51e0\u5341\u884c\u811a\u672c\u548c\u6807\u51c6\u7684 HTTP \u534f\u8bae&#xff0c;\u5c31\u7ed9\u6570\u636e\u4e2d\u5fc3\u7a7f\u4e0a\u4e86\u4e00\u4ef6\u201c\u53ef\u542c\u3001\u53ef\u89c6\u201d\u7684\u7269\u7406\u9632\u5fa1\u5916\u8863\u3002\u5982\u679c\u4f60\u76ee\u524d\u4e5f\u9971\u53d7\u7ebf\u4e0a\u4f4e\u6548\u901a\u77e5\u7684\u56f0\u6270&#xff0c;\u4e0d\u59a8\u4e5f\u5c1d\u8bd5\u4e00\u4e0b\u8fd9\u79cd\u8f6f\u786c\u4e92\u901a\u7684\u8fb9\u7f18\u544a\u8b66\u65b9\u6848\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001 \u80cc\u666f&#xff1a;\u5f53\u8fd0\u7ef4\u5f00\u59cb\u5bf9\u201c\u9489\u9489\/\u90ae\u4ef6\u544a\u8b66\u201d\u4ea7\u751f\u514d\u75ab\u4f5c\u4e3a\u8fd0\u7ef4\u6216\u540e\u7aef\u5f00\u53d1&#xff0c;\u5927\u5bb6\u4e00\u5b9a\u9047\u5230\u8fc7\u8fd9\u79cd\u573a\u666f&#xff1a;\u76d1\u63a7\u5e73\u53f0\u4e0a\u914d\u7f6e\u4e86\u5bc6\u5bc6\u9ebb\u9ebb\u7684\u544a\u8b66\u89c4\u5219&#xff08;Prometheus \/ Zabbix \/ Grafana&#xff09;&#xff0c;\u6bcf\u5929\u4f01\u4e1a\u5fae\u4fe1\u3001\u9489\u9489\u7fa4\u6216\u8005\u90ae\u7bb1\u91cc\u80fd\u6536\u5230\u5927\u51e0\u767e\u6761\u901a\u77e5\u3002\u65f6\u95f4\u4e00\u957f&#xff0c;\u4eba\u8111\u5c31\u4f1a\u81ea\u52a8\u4ea7\u751f\u201c\u544a\u8b66\u514d\u75ab\u201d\u3002\u6709\u51e0\u6b21\u6838\u5fc3\u4ea4\u6362\u673a\u51fa\u73b0\u5076\u53d1\u6027\u4e22\u5305\u3001\u6216\u8005\u6570\u636e\u5e93\u524d\u7f6e\u673a\u5185\u5b58\u6ea2\u51fa&#xff0c;\u9ad8\u5371\u544a\u8b66\u76f4\u63a5\u88ab\u6df9\u6ca1\u5728\u4e86\u5bc6\u5bc6\u9ebb<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[9892,556,555],"topic":[],"class_list":["post-87431","post","type-post","status-publish","format-standard","hentry","category-server","tag-9892","tag-556","tag-555"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u300a\u673a\u623f\u8fd0\u7ef4\u81ea\u6551\u6307\u5357\uff1a\u5982\u4f55\u5229\u7528 Python + \u5c40\u57df\u7f51 WebHook \u642d\u5efa\u4e00\u5957\u7269\u7406\u7ea7\u201c\u58f0\u5149\u201d\u9632\u6f0f\u62a5\u544a\u8b66\u7cfb\u7edf\u300b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/87431.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u300a\u673a\u623f\u8fd0\u7ef4\u81ea\u6551\u6307\u5357\uff1a\u5982\u4f55\u5229\u7528 Python + \u5c40\u57df\u7f51 WebHook \u642d\u5efa\u4e00\u5957\u7269\u7406\u7ea7\u201c\u58f0\u5149\u201d\u9632\u6f0f\u62a5\u544a\u8b66\u7cfb\u7edf\u300b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u4e00\u3001 \u80cc\u666f&#xff1a;\u5f53\u8fd0\u7ef4\u5f00\u59cb\u5bf9\u201c\u9489\u9489\/\u90ae\u4ef6\u544a\u8b66\u201d\u4ea7\u751f\u514d\u75ab\u4f5c\u4e3a\u8fd0\u7ef4\u6216\u540e\u7aef\u5f00\u53d1&#xff0c;\u5927\u5bb6\u4e00\u5b9a\u9047\u5230\u8fc7\u8fd9\u79cd\u573a\u666f&#xff1a;\u76d1\u63a7\u5e73\u53f0\u4e0a\u914d\u7f6e\u4e86\u5bc6\u5bc6\u9ebb\u9ebb\u7684\u544a\u8b66\u89c4\u5219&#xff08;Prometheus \/ Zabbix \/ Grafana&#xff09;&#xff0c;\u6bcf\u5929\u4f01\u4e1a\u5fae\u4fe1\u3001\u9489\u9489\u7fa4\u6216\u8005\u90ae\u7bb1\u91cc\u80fd\u6536\u5230\u5927\u51e0\u767e\u6761\u901a\u77e5\u3002\u65f6\u95f4\u4e00\u957f&#xff0c;\u4eba\u8111\u5c31\u4f1a\u81ea\u52a8\u4ea7\u751f\u201c\u544a\u8b66\u514d\u75ab\u201d\u3002\u6709\u51e0\u6b21\u6838\u5fc3\u4ea4\u6362\u673a\u51fa\u73b0\u5076\u53d1\u6027\u4e22\u5305\u3001\u6216\u8005\u6570\u636e\u5e93\u524d\u7f6e\u673a\u5185\u5b58\u6ea2\u51fa&#xff0c;\u9ad8\u5371\u544a\u8b66\u76f4\u63a5\u88ab\u6df9\u6ca1\u5728\u4e86\u5bc6\u5bc6\u9ebb\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/87431.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-07-30T01:48:23+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/87431.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/87431.html\",\"name\":\"\u300a\u673a\u623f\u8fd0\u7ef4\u81ea\u6551\u6307\u5357\uff1a\u5982\u4f55\u5229\u7528 Python + \u5c40\u57df\u7f51 WebHook \u642d\u5efa\u4e00\u5957\u7269\u7406\u7ea7\u201c\u58f0\u5149\u201d\u9632\u6f0f\u62a5\u544a\u8b66\u7cfb\u7edf\u300b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-07-30T01:48:23+00:00\",\"dateModified\":\"2026-07-30T01:48:23+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/87431.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/87431.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/87431.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u300a\u673a\u623f\u8fd0\u7ef4\u81ea\u6551\u6307\u5357\uff1a\u5982\u4f55\u5229\u7528 Python + \u5c40\u57df\u7f51 WebHook \u642d\u5efa\u4e00\u5957\u7269\u7406\u7ea7\u201c\u58f0\u5149\u201d\u9632\u6f0f\u62a5\u544a\u8b66\u7cfb\u7edf\u300b\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u300a\u673a\u623f\u8fd0\u7ef4\u81ea\u6551\u6307\u5357\uff1a\u5982\u4f55\u5229\u7528 Python + \u5c40\u57df\u7f51 WebHook \u642d\u5efa\u4e00\u5957\u7269\u7406\u7ea7\u201c\u58f0\u5149\u201d\u9632\u6f0f\u62a5\u544a\u8b66\u7cfb\u7edf\u300b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/87431.html","og_locale":"zh_CN","og_type":"article","og_title":"\u300a\u673a\u623f\u8fd0\u7ef4\u81ea\u6551\u6307\u5357\uff1a\u5982\u4f55\u5229\u7528 Python + \u5c40\u57df\u7f51 WebHook \u642d\u5efa\u4e00\u5957\u7269\u7406\u7ea7\u201c\u58f0\u5149\u201d\u9632\u6f0f\u62a5\u544a\u8b66\u7cfb\u7edf\u300b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u4e00\u3001 \u80cc\u666f&#xff1a;\u5f53\u8fd0\u7ef4\u5f00\u59cb\u5bf9\u201c\u9489\u9489\/\u90ae\u4ef6\u544a\u8b66\u201d\u4ea7\u751f\u514d\u75ab\u4f5c\u4e3a\u8fd0\u7ef4\u6216\u540e\u7aef\u5f00\u53d1&#xff0c;\u5927\u5bb6\u4e00\u5b9a\u9047\u5230\u8fc7\u8fd9\u79cd\u573a\u666f&#xff1a;\u76d1\u63a7\u5e73\u53f0\u4e0a\u914d\u7f6e\u4e86\u5bc6\u5bc6\u9ebb\u9ebb\u7684\u544a\u8b66\u89c4\u5219&#xff08;Prometheus \/ Zabbix \/ Grafana&#xff09;&#xff0c;\u6bcf\u5929\u4f01\u4e1a\u5fae\u4fe1\u3001\u9489\u9489\u7fa4\u6216\u8005\u90ae\u7bb1\u91cc\u80fd\u6536\u5230\u5927\u51e0\u767e\u6761\u901a\u77e5\u3002\u65f6\u95f4\u4e00\u957f&#xff0c;\u4eba\u8111\u5c31\u4f1a\u81ea\u52a8\u4ea7\u751f\u201c\u544a\u8b66\u514d\u75ab\u201d\u3002\u6709\u51e0\u6b21\u6838\u5fc3\u4ea4\u6362\u673a\u51fa\u73b0\u5076\u53d1\u6027\u4e22\u5305\u3001\u6216\u8005\u6570\u636e\u5e93\u524d\u7f6e\u673a\u5185\u5b58\u6ea2\u51fa&#xff0c;\u9ad8\u5371\u544a\u8b66\u76f4\u63a5\u88ab\u6df9\u6ca1\u5728\u4e86\u5bc6\u5bc6\u9ebb","og_url":"https:\/\/www.wsisp.com\/helps\/87431.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-07-30T01:48:23+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/87431.html","url":"https:\/\/www.wsisp.com\/helps\/87431.html","name":"\u300a\u673a\u623f\u8fd0\u7ef4\u81ea\u6551\u6307\u5357\uff1a\u5982\u4f55\u5229\u7528 Python + \u5c40\u57df\u7f51 WebHook \u642d\u5efa\u4e00\u5957\u7269\u7406\u7ea7\u201c\u58f0\u5149\u201d\u9632\u6f0f\u62a5\u544a\u8b66\u7cfb\u7edf\u300b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-07-30T01:48:23+00:00","dateModified":"2026-07-30T01:48:23+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/87431.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/87431.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/87431.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u300a\u673a\u623f\u8fd0\u7ef4\u81ea\u6551\u6307\u5357\uff1a\u5982\u4f55\u5229\u7528 Python + \u5c40\u57df\u7f51 WebHook \u642d\u5efa\u4e00\u5957\u7269\u7406\u7ea7\u201c\u58f0\u5149\u201d\u9632\u6f0f\u62a5\u544a\u8b66\u7cfb\u7edf\u300b"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/87431","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=87431"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/87431\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=87431"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=87431"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=87431"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=87431"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}