Convert cURL commands to Python
Paste any curl command, including Copy as cURL straight from Chrome, Firefox, or Edge devtools, and get ready-to-run Python requests code with headers, JSON bodies, auth, and cookies.
cURL command you want to convert to Python
Requires pip install requests. Converts live as you type.
How to copy a request as cURL from your browser
The most common workflow: you debug a request in devtools, then want it as Python. Grab it like this:
Chrome or Edge
- Open devtools (F12) and go to the Network tab.
- Reproduce the request (reload the page or trigger the API call).
- Right-click the request โ Copy โ Copy as cURL.
- Paste it above: multi-line commands,
$'...'quoting, and\continuations all work.
Firefox
- Open the Network tab in devtools.
- Right-click the request โ Copy โ Copy as cURL.
Want to run the command first and inspect the response? Use the free cURL Tester, then convert it to Python here.
Why convert cURL to Python requests?
cURL is perfect for a quick one-off check, but the moment you need retries, loops, assertions, or CI integration, Python wins. Converting a known-good curl command is the fastest way to bootstrap a Python script: you skip the fiddly part of getting headers, auth, and the body exactly right, because the browser already captured them.
- Health checks in CI/CD: turn a deployment smoke-test curl into a pipeline step with real assertions on status and body.
- Retries and backoff: wrap the generated call in a retry loop instead of re-running curl by hand.
- API automation: chain requests (login โ fetch โ post) with session reuse in a
requests.Session(). - Webhook replay: debug a failing webhook by replaying the exact captured request from Python.
What the converter understands
-X, --request: HTTP method (POST is inferred when data is present)-H, --header: headers dict (repeatable), plus-A(User-Agent) and-e(Referer)-d, --data, --data-raw, --data-binary, --data-urlencode, --json: JSON bodies become a native Python dict passed asjson=; form data becomes adata=dict-F, --form: multipart uploads (@filebecomesopen(..., "rb"))-u, --user:auth=(user, password)tuple-b, --cookie: cookies dict-G: moves data intoparams=-k,-m,-x:verify=False,timeout=,proxies=- Line continuations (
\), single/double quotes, and$'...'ANSI-C quoting from devtools
Unknown flags are skipped and noted in a comment at the bottom of the generated code, so nothing fails silently.
Frequently asked questions
Does it handle headers, cookies, and authentication?
Yes. -H headers, -b cookies, and -u Basic auth all convert to their idiomatic requests equivalents (headers=, cookies=, auth=).
Why does Chrome's Copy as cURL look so odd?
Chrome wraps header values in ANSI-C quoting ($'...') and breaks the command across lines with backslashes so it pastes safely into a terminal. The converter parses all of that, so just paste it as-is.
Is my command uploaded anywhere?
No. Conversion is pure client-side JavaScript, so tokens with API keys or passwords never leave your machine.
Related free tools
cURL Tester (run a command live) ยท cURL to JSON Converter (sibling tool) ยท JSON Formatter & Validator (inspect payloads) ยท YAML to JSON Converter (translate configs)
๐ Need an IP to whitelist?
Get a dedicated static EU outbound IP for Banks, payments, EHRs, APIs, AI.