1. 转换带 JSON 载荷的 POST 请求
后端开发人员背景
需要对接一个第三方支付 API,文档只提供了 cURL 格式的创建订单接口示例。
问题
手动将 cURL 中的 Headers 和 JSON 字符串拼装成 Python requests 代码既繁琐又容易出错。
如何使用
将 cURL 命令粘贴到输入框中,保持“格式化请求体”和“包含注释”勾选,点击转换。
curlCommand: curl -X POST https://api.example.com/v1/orders -H "Content-Type: application/json" -H "Authorization: Bearer token123" -d '{"amount": 100, "currency": "USD"}'
prettyBody: true
includeComments: true结果
成功生成包含 headers 字典和格式化 json 字典的 Python requests.post 代码,可直接运行。