我可以使用 postman 发送邮寄请求。但我的 python requests 库失败了:
headers = {'Content-Type': 'application/xml'}
r = requests.post(url, data=xml, headers=headers)
为什么postman测试没问题? postman 和 python 请求 post 有什么区别?
最佳答案
好的 - 只是回答这个问题,因为 @OluwafemiSule 的原始链接现在返回 404。在 Postman 中,右上角“发送”下拉菜单下方有一个标有“代码”的小文本按钮。按下该按钮,您可以选择查看以多种语言运行的传输编码 - 包括 python/requests。截至 02/2019 的更新链接:https://learning.getpostman.com/docs/postman/sending_api_requests/generate_code_snippets/#___gatsby
关于python - API测试: Postman vs Python Requests,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49680816/