import requests import json # API接口地址 API_URL = "http://localhost:5000/api/emails" # 凭据信息 credentials = { "email": "eedbbfdd186@outlook.com", "client_id": "9e5f94bc-e8a4-4e73-b8be-63364c29d753", "refresh_token": "M.C544_BL2.0.U.-CmrNXHVufVZdj1*CaDuSw4WSQYVfF7ILMi4XYHeVQ!YJm56uJO5HPG9I2bOJIRrS3c5FgP9sDKB*HjA3O6wVY4Cr7hzNGWjujT*xZ5k4gOjRDVXx9ocaY1bf5J2HZgAoBJYjFq76*3h2xddMEGqp7iFjYDo3B9rcfRGh!G6rJ38vkWBSGw!7hcj21IWdZD!eIZqCx1o2tDrzeH*fRnuf*DoTQEFCDnFpCoulmQHDUBEFiBT8H*TzupejEgWTmXewN9tpcQwFituIbGScsDWdRuB5pcF63p7jazZdeZ8Bpa7pQb5Fc4mYUSwQS4Qx9CNNMYnwYuhiAVEXPcoppWCA7WXF!bgOxa7IuZASnWMiC!jqUu77KnwrHWZD14SDrFfwBQ$$", "limit": 5 # 获取最新的5封邮件 } headers = { "Content-Type": "application/json" } try: # 发送POST请求 response = requests.post( API_URL, headers=headers, json=credentials ) # 输出响应内容 print(f"状态码: {response.status_code}") print("响应内容:") print(json.dumps(response.json(), indent=2, ensure_ascii=False)) # 如果成功,提取新的refresh_token if response.status_code == 200: result = response.json() if "refresh_token" in result and result["refresh_token"] != credentials["refresh_token"]: print(f"\n新的refresh_token: {result['refresh_token']}") except requests.exceptions.RequestException as e: print(f"请求失败: {e}")