cURL to Python Converter
Paste any curl command and instantly get clean Python code for requests, httpx, or aiohttp.
Why use this tool?
Use this converter when you have a working curl command — from API docs, your browser's 'Copy as cURL', or a colleague — and need it as Python. It parses the flags for you and emits idiomatic code for requests, httpx, or aiohttp, correctly handling headers, JSON and form bodies, basic auth, and cookies so you don't translate them by hand.
curl -X POST https://api.example.com/v1/users \
-H "Content-Type: application/json" \
-H "Authorization: Bearer token123" \
-d '{"name": "Ada", "role": "admin"}'import requests
url = "https://api.example.com/v1/users"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer token123"
}
json_data = {
"name": "Ada",
"role": "admin"
}
response = requests.post(url, headers=headers, json=json_data)
print(response.status_code)
print(response.text)Runs entirely in your browser — the command is never uploaded. Supports headers, JSON & form bodies, basic auth (-u), cookies, multipart (-F), -k (verify=False) and -L (follow redirects).
About cURL to Python Converter
Developers constantly move between curl and Python: browser dev tools and most API references give you a curl command, but your automation, scraper, or integration is written in Python. Translating headers, request bodies, authentication, and flags like -k or -L by hand is tedious and error-prone.
This tool tokenizes the curl command exactly like a shell would — respecting quotes and backslash line-continuations — then rebuilds it as a normalized HTTP request. It detects the method, splits headers, parses JSON bodies into real Python dictionaries, converts form data, and maps basic auth (-u), cookies (-b), multipart uploads (-F), insecure mode (-k → verify=False), and redirects (-L).
You get ready-to-run output for three libraries: the ubiquitous requests, the modern sync/async httpx, and fully asynchronous aiohttp. Everything happens in your browser — the command is never uploaded to a server.
Frequently Asked Questions
Explore Other Tools
Ruff Linter & Formatter
Run Ruff online — the fast Rust linter & formatter that replaces Flake8, isort and Black. Free, no install, runs in your browser.
Ruff Playground
Check Ruff online free: paste Python and watch ruff check diagnostics, formatting, the AST, tokens and formatter IR update live, with an editable config — all in your browser.
Python Marshal Encryptor
Compile Python to version-locked marshaled bytecode and get a ready-to-run loader. Pick your target Python version (3.10–3.13). Runs 100% in your browser.
Python .pyc Decompiler
Decompile a compiled Python .pyc file back to readable source — all versions, running in your browser via WebAssembly. Nothing uploaded.