Files
Neo-ZQYY/scripts/ops/test_mvp_api.py

20 lines
596 B
Python

"""快速验证 MVP API 接口"""
import urllib.request
import json
url = "http://127.0.0.1:8000/api/xcx-test"
print(f"请求: GET {url}")
try:
req = urllib.request.Request(url)
with urllib.request.urlopen(req, timeout=5) as resp:
data = json.loads(resp.read().decode())
print(f"状态码: {resp.status}")
print(f"响应: {data}")
if data.get("ti") == "t91":
print("✓ MVP API 验证通过!")
else:
print(f"✗ 期望 ti='t91',实际 ti='{data.get('ti')}'")
except Exception as e:
print(f"✗ 请求失败: {e}")