develop: 重做 fault-log-analyzer 分析模块(遵守模块开发规范)
This commit is contained in:
parent
de5638076c
commit
ab1a9b7709
29
.gitignore
vendored
Normal file
29
.gitignore
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
# Python
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*.egg-info/
|
||||
.eggs/
|
||||
build/
|
||||
dist/
|
||||
|
||||
# 虚拟环境
|
||||
.venv/
|
||||
venv/
|
||||
env/
|
||||
|
||||
# 测试与工具缓存
|
||||
.pytest_cache/
|
||||
.mypy_cache/
|
||||
.coverage
|
||||
htmlcov/
|
||||
|
||||
# IDE / 编辑器
|
||||
.vscode/
|
||||
.idea/
|
||||
*.swp
|
||||
*.swo
|
||||
*~
|
||||
|
||||
# 本地配置
|
||||
.env
|
||||
*.local
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -30,7 +30,7 @@ class _JsonHandler(BaseHTTPRequestHandler):
|
||||
filter_rule_repo: FilterRuleRepository
|
||||
|
||||
# -- 基础工具 ---------------------------------------------------------
|
||||
def _send_json(self, code: int, payload: dict, status: int = 200) -> None:
|
||||
def _send_json(self, payload: dict, status: int = 200) -> None:
|
||||
body = json.dumps(payload, ensure_ascii=False).encode("utf-8")
|
||||
self.send_response(status)
|
||||
self.send_header("Content-Type", "application/json; charset=utf-8")
|
||||
@ -39,10 +39,10 @@ class _JsonHandler(BaseHTTPRequestHandler):
|
||||
self.wfile.write(body)
|
||||
|
||||
def _ok(self, data) -> None:
|
||||
self._send_json(200, {"code": 0, "message": "ok", "data": data})
|
||||
self._send_json({"code": 0, "message": "ok", "data": data})
|
||||
|
||||
def _error(self, code: int, message: str, status: int = 400) -> None:
|
||||
self._send_json(status, {"code": code, "message": message, "data": None})
|
||||
self._send_json({"code": code, "message": message, "data": None}, status)
|
||||
|
||||
def _read_body(self) -> dict:
|
||||
length = int(self.headers.get("Content-Length", "0") or "0")
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user