fix(agent): 提拔 urllib 依赖至全局作用域,修复局部变量遮蔽导致的 Webhook 空回复崩溃 bug (v3.0.4-hotfix)

This commit is contained in:
hotyue
2026-04-11 02:23:52 +00:00
parent ca2608756d
commit 9d2aa9fcd5

View File

@@ -65,6 +65,7 @@ import os
import html
# ================== [v3.0.4 新增密码学与解析依赖] ==================
import urllib.parse
import urllib.request # [修复] 提升至全局作用域,防止局部变量遮蔽
import hmac
import hashlib
import time
@@ -167,9 +168,7 @@ class AgentHandler(http.server.BaseHTTPRequestHandler):
self.send_header("Content-type", "text/plain")
self.end_headers()
self.wfile.write(b"Action Accepted: fetch_log\n")
import urllib.request
try:
config = {}
if os.path.exists('/opt/ip_sentinel/config.conf'):