data:dict = {
"username":"admin",
"password":"123456"
}
headers = {
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36",
"Content-Type": "application/json;charset=UTF-8"
}
# 设置请求头 headers
session.headers = headers
# requests: 发送请求:
方法一: resp_login = session.post(url=login_url, data=json.dumps(data))
方法二: resp_login = session.post(url=login_url, json=data)
header中: “Content-Type“: “application/json;charset=UTF-8 ; requests: 发送请求
最新推荐文章于 2024-04-30 09:29:02 发布