Files
dekun 53863559f4 Initialize crypto_monitor_user (user edition) from monitor codebase.
Retarget git remote, install path, and deploy docs from crypto_monitor to crypto_monitor_user.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-17 16:18:13 +08:00

36 lines
1.1 KiB
Python

#!/usr/bin/env python3
"""Diagnose page render errors (run inside instance dir with venv)."""
from __future__ import annotations
import os
import sys
import traceback
def main() -> int:
inst = sys.argv[1] if len(sys.argv) > 1 else "crypto_monitor_binance"
root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
os.chdir(os.path.join(root, inst))
sys.path.insert(0, os.getcwd())
from app import app # noqa: WPS433
paths = ["/trade", "/key_monitor", "/strategy", "/login"]
with app.test_client() as client:
with client.session_transaction() as sess:
sess["logged_in"] = True
for path in paths:
try:
resp = client.get(path)
print(f"{inst} {path} -> {resp.status_code}")
if resp.status_code >= 400:
body = resp.get_data(as_text=True)
print(body[:3000])
except Exception:
print(f"{inst} {path} -> EXCEPTION")
traceback.print_exc()
return 0
if __name__ == "__main__":
raise SystemExit(main())