import requests import json # 目标 URL url = 'http://127.0.0.1:8000/polls/register/' # 发送 POST 请求,使用 json 参数而不是 data data = { 'user': 'zmm12300000', # 用于测试的用户名 'pwd': 'Zmm12314' # 用于测试的密码 } response = requests.post(url, json=data) # 使用 json 参数发送数据 # 检查响应状态和内容 if response.status_code == 200: print("注册成功:", response.json()) else: print("注册失败:", response.status_code, response.json())