接口自动化响应数据的获取
https://editor.csdn.net/md/?articleId=115450235
import requests
HOST = "http://xxx.xx.xx.xx:0000"
# 1- url
url = f"{HOST}/xxx"
# 2- 参数
payload = {"username": "xxx", "password": "xxx"}
# 3- 发请求
response = requests.post(url, data=payload)
# 4-获取请求信息
print(response.request.headers)
请求相关信息
response.request.xxx
查看请求数据:
response.request.url # 请求url
response.request.body # 请求体
response.request.headers # 请求头