cURL → Python
Runs locally in your browser. Your input is not uploaded.Free, no sign-up
cURL command
Python
Convert cURL commands to Python requests code.
How to use the cURL to Python converter
- Paste a curl command, or click Sample.
- Copy the code; it uses the requests library (
pip install requests).
What's translated
- JSON bodies become a Python dict sent with
json=(withTrue,FalseandNone), so requests sets the Content-Type for you. -Fuploads becomefiles=anddata=,-ubecomesauth=, and--max-timebecomestimeout=.-kbecomesverify=False, with a warning: it turns off certificate checks.
Frequently asked questions
Does it work with httpx?
Mostly: httpx's API mirrors requests, so httpx.post(url, headers=…, json=…) works after changing the import. Uploads and some options differ slightly.
Which cURL options are understood?
The ones that shape a request: -X, -H, -d and its variants (--data-raw, --data-binary, --data-urlencode, --json), -F, -u, -b, -A, -e, -G, -I, -L, -k and --max-time. Output options like -s or -o are ignored, and anything else is listed under the result.
Can I paste "Copy as cURL" from the browser?
Yes, in bash or Windows format: $'…' quoting and \, ^ or ` line continuations are handled. Remove session cookies and tokens you don't want in your code.
Is my command uploaded or run?
No. It's parsed and converted in your browser; nothing is sent.
Related tools
All tools- cURL GeneratorBuild cURL commands from a method, URL, headers, body and authentication.
- cURL → JavaConvert cURL commands to Java HttpClient, Spring RestClient or WebClient code.
- cURL → JavaScriptConvert cURL commands to JavaScript fetch() code.
- HTTP Request BuilderBuild an HTTP request and generate the raw message plus cURL, Java, JavaScript and Python code.
- HTTP Status Code LookupLook up HTTP status codes with clear descriptions and typical causes.