Api测试:Postman与Python请求

问题描述 投票:1回答:1

我可以使用邮递员发送邮件请求。但我失败了python请求库:

headers = {'Content-Type': 'application/xml'}
r = requests.post(url, data=xml, headers=headers)

为什么邮差测试没问题? postman和python请求帖子有什么区别?

python xml api python-requests postman
1个回答
1
投票

好的 - 只是为了回答这个问题,因为@OluwafemiSule的原始链接现在返回404.在邮递员中,在“发送”下拉的右上方是一个标有“代码”的小文本按钮。按下它,您可以选择查看编码的传输以大量语言运行 - 包括python / requests。截至02/2019的更新链接:https://learning.getpostman.com/docs/postman/sending_api_requests/generate_code_snippets/#___gatsby

© www.soinside.com 2019 - 2024. All rights reserved.