feat: add root directory files and interactive module - Add account manager, test files, and interactive GUI module; Update requirements.txt
This commit is contained in:
48
test_api_response.py
Normal file
48
test_api_response.py
Normal file
@@ -0,0 +1,48 @@
|
||||
import requests
|
||||
import json
|
||||
from datetime import datetime
|
||||
|
||||
def test_member_status(machine_id: str):
|
||||
"""测试会员状态接口"""
|
||||
print(f"\n=== 测试会员状态 ===")
|
||||
print(f"设备码: {machine_id}")
|
||||
|
||||
try:
|
||||
# 构造状态检查请求
|
||||
endpoint = "https://cursorapi.nosqli.com/admin/api.member/status"
|
||||
data = {
|
||||
"machine_id": machine_id
|
||||
}
|
||||
headers = {
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
|
||||
print("\n发送请求...")
|
||||
response = requests.post(endpoint, json=data, headers=headers, timeout=10)
|
||||
print(f"状态码: {response.status_code}")
|
||||
|
||||
print("\n响应数据:")
|
||||
response_data = response.json()
|
||||
print(json.dumps(response_data, indent=2, ensure_ascii=False))
|
||||
|
||||
if response_data.get("code") == 200:
|
||||
data = response_data.get("data", {})
|
||||
print("\n解析后的信息:")
|
||||
print(f"状态: {data.get('status', 'unknown')}")
|
||||
print(f"到期时间: {data.get('expire_time', '')}")
|
||||
print(f"剩余天数: {data.get('days_left', 0)}")
|
||||
print(f"总天数: {data.get('total_days', 0)}")
|
||||
|
||||
print("\n激活记录:")
|
||||
for record in data.get("activation_records", []):
|
||||
print(f"- 激活码: {record.get('code', '')}")
|
||||
print(f" 激活时间: {record.get('activation_time', '')}")
|
||||
print(f" 天数: {record.get('days', 0)}")
|
||||
print()
|
||||
|
||||
except Exception as e:
|
||||
print(f"\n请求失败: {str(e)}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
machine_id = "b2c32bdeff8d3f0d33dc88f2aadea6bc"
|
||||
test_member_status(machine_id)
|
||||
Reference in New Issue
Block a user