CURL CONVERTER
cURL 转换器,贴进来就转好。
把终端里复制的 curl 命令粘贴进来,一键生成 Python(requests)、JavaScript(fetch)、Go、Java 请求代码。全部在浏览器本地完成,不上传。
本页处理在浏览器本地完成
怎么用 cURL 转换器?
在左侧粘贴一条 curl 命令(从浏览器开发者工具「Copy as cURL」、Postman「复制为 cURL」等处得到),右侧会自动识别请求方法、URL、请求头、请求体和认证信息,并生成可直接运行的代码。切换语言即可查看不同版本。支持 -X/-H/-d/-u/-G/-F 等常见参数。
示例与注意事项Example & notes
一个例子A worked example
把浏览器「Copy as cURL」得到的一整段命令粘进来,立刻得到等价的 Python requests 与 Go 代码,连请求头和 body 都补齐。Paste a whole "Copy as cURL" command and get equivalent Python requests and Go code, headers and body included.
注意事项Things to watch
- 命令里的 Cookie、Authorization 等敏感信息会原样出现在生成代码中,粘贴或分享前请先替换占位符。Cookies and Authorization headers appear verbatim in the generated code — swap them for placeholders before sharing.
- 多行命令(反斜杠续行)可直接粘贴,解析时会自动合并。Multi-line commands with backslash continuations can be pasted as-is; the parser joins them.
- shell 特性(管道、变量展开、命令替换)不在支持范围,转换前请先还原成纯 curl 命令。Shell features such as pipes, variable expansion and command substitution are not supported — reduce the input to a plain curl command first.
相关问答More Q&A
支持哪些目标语言?Which target languages are supported?
Python requests、JavaScript(fetch/axios)、Go、Java、PHP、Node 等常见写法,生成后可直接复制进项目。Python requests, JavaScript (fetch/axios), Go, Java, PHP and Node — ready to copy into your project.
会真的请求这个地址吗?Will it actually call that URL?
不会。只做文本解析与代码生成,不会发出任何网络请求,内网地址也能安全粘贴。No. It only parses text and writes code, so even internal hostnames are safe to paste.