初始化提交,包含完整的邮件系统代码
This commit is contained in:
21
get_code.py
Normal file
21
get_code.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import requests
|
||||
|
||||
# 获取邮箱ID为2的所有邮件
|
||||
response = requests.get("http://localhost:5000/api/mailboxes/2/emails")
|
||||
data = response.json()
|
||||
|
||||
# 打印响应状态
|
||||
print(f"API响应状态: {response.status_code}")
|
||||
print(f"API响应内容: {data}")
|
||||
|
||||
# 如果成功,提取验证码
|
||||
if data.get('success', False):
|
||||
emails = data.get('emails', [])
|
||||
for email in emails:
|
||||
print(f"\n邮件ID: {email.get('id')}")
|
||||
print(f"主题: {email.get('subject')}")
|
||||
print(f"发件人: {email.get('sender')}")
|
||||
print(f"接收时间: {email.get('received_at')}")
|
||||
print(f"验证码字段: {email.get('verification_code')}")
|
||||
else:
|
||||
print(f"获取邮件失败: {data.get('error', '未知错误')}")
|
||||
Reference in New Issue
Block a user