Developer Utility

把杂乱的 cURL,变成干净的 Python。

贴入命令后即时输出 `requests` 或 `httpx` 代码,保留请求头、query、body、认证、表单和常见网络选项。

  • 纯前端运行,不依赖后端
  • 输出可直接复制到项目里
  • 对不支持参数给出明确提醒
$ curl https://api.example.com/messages \
  -H "Authorization: Bearer sk-demo" \
  -H "Content-Type: application/json" \
  -d '{"message":"hello"}'

import requests

headers = {
    "Authorization": "Bearer sk-demo",
    "Content-Type": "application/json",
}

payload = {
    "message": "hello",
}

response = requests.post(
    "https://api.example.com/messages",
    headers=headers,
    json=payload,
)

Playground

输入命令,右侧拿代码

Input

cURL Command

Output

Python Code

Detected

请求拆解

Notes

转换提示

    Coverage

    当前支持的 cURL 能力

    Headers & Auth

    `-H`、`-u`、`-A`、`-e`、`-b`、Bearer / Basic Auth

    Body

    `-d`、`--data-*`、`--json`、URL encoded、原始文本、JSON

    Upload

    `-F` / `--form` 文本字段与文件字段,自动生成 `with open(...)`

    Network

    `-G`、`-L`、`-k`、`--compressed`、`--max-time`