You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
431 B
20 lines
431 B
import requests
|
|
|
|
# 目标 URL
|
|
url = 'http://127.0.0.1:8000/polls/index/'
|
|
|
|
# 测试数据
|
|
data = {
|
|
'user': 'zmm', # 用于测试的用户名
|
|
'pwd': 'Zmm' # 用于测试的密码
|
|
}
|
|
|
|
# 发送 POST 请求
|
|
response = requests.post(url, data=data)
|
|
|
|
# 检查响应状态和内容
|
|
if response.status_code == 200:
|
|
print("登录成功:", response.json())
|
|
else:
|
|
print("登录失败:", response.status_code, response.json())
|