cURL to Python Converter (requests, httpx & aiohttp)
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 in your browser. Supports headers, JSON & form bodies, basic auth (-u), cookies, multipart (-F), -k (verify=False) and -L (follow redirects).
Tool facts
- Supported Python
- Python 3.x (requests, httpx, or http.client)
- Input limit
- Limited only by your device
- Last reviewed
- 2026-08-25
What it can't do
- •Send the request — it only converts the curl command into Python code.
- •Translate advanced curl flags with no Python equivalent (a few are skipped).
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.
For a deeper walkthrough — handling headers, cookies, authentication and JSON bodies — see our guide on converting cURL commands to Python requests.
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
A deep Ruff playground: inspect the AST and token stream Ruff parses, its formatter IR, and live ruff check diagnostics, while editing the Ruff config and sharing a link that reopens your exact setup.
Python Marshal Encryptor
Compile Python to version-locked marshaled bytecode with optional zlib or zstd compression and get a ready-to-run loader. Target Python 3.10–3.14. Runs 100% in your browser.
Python Marshal Decrypt
Reverse a marshal loader and recover readable Python source — base64-decode, decompress (zlib/zstd), unmarshal, decompile, plus disassembly and a downloadable .pyc. Runs 100% in your browser.