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, verify=False) 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)}") def test_get_unused_account(machine_id: str): """测试获取未使用账号接口""" print(f"\n=== 测试获取未使用账号 ===") print(f"设备码: {machine_id}") try: # 构造请求 endpoint = "https://cursorapi.nosqli.com/admin/api.account/getUnused" data = { "machine_id": machine_id } headers = { "Content-Type": "application/json" } print("\n发送请求...") response = requests.post(endpoint, json=data, headers=headers, timeout=30, verify=False) 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: account_data = response_data.get("data", {}) print("\n账号信息:") print(f"邮箱: {account_data.get('email', '')}") print(f"到期时间: {account_data.get('expire_time', '')}") print(f"剩余天数: {account_data.get('days_left', 0)}") except Exception as e: print(f"\n请求失败: {str(e)}") if __name__ == "__main__": # 禁用SSL警告 requests.packages.urllib3.disable_warnings() machine_id = "b2c32bdeff8d3f0d33dc88f2aadea6bc" test_member_status(machine_id) test_get_unused_account(machine_id)