python 自动化测试接口
比如我们要测试接口:identity/chatRecords/pages
已在Postman中有,那我们就可以直接从里面复制出Python脚本
新建: pagerequest.py
import requests
import json
url = "http://192.168.31.132:70/identity/chatRecords/pages"
payload = json.dumps({
"pageNumber": 1,
"pageSize": 50,
"field": "",
"isAscending": False,
"message": ""
})
headers = {
'accept': 'text/plain',
'Authorization': 'Bearer eyJhbGciOiJSUzIRJk-A',
'Content-Type': 'application/json-patch+json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
运行效果:
原文地址:https://blog.csdn.net/xiaoxionglove/article/details/142298516
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!