DEV · CURL
cURL 转代码
粘贴 cURL 命令,自动解析 -X / -H / -d / -u / -k 等参数,一键生成 Python / JavaScript / Go / Rust / PHP 请求代码。
cURL 命令
目标语言:
Python 代码
import requests
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer token123",
}
response = requests.post("https://api.example.com/data", headers=headers, data='{"name":"test","value":42}')
print(response.status_code)
print(response.text)