cURL to Python (requests)

Parse a curl command (from the browser "Copy as cURL") and generate an equivalent runnable Python script using requests or httpx — method, headers, JSON/form bodies, cookies, basic auth and TLS options included.

Paste your curl command

How it works

About cURL to Python

When you copy a request out of the browser network tab or a README, curl is the format you get — but a Python script, test or automation job wants requests or httpx instead. This converter reproduces the request semantics: repeated headers are merged into a dict, JSON-looking bodies become json= so they are serialized correctly, cookies become a cookies= dict, and basic auth becomes auth=(user, password).

The generated script is complete and runnable: imports, a try/except around the call, a printed status code and response text. Options that have no Python equivalent — like -o file output or exotic curl flags — are kept as comments so you know what was skipped. Defaults differ in one notable way: curl sends Content-Type: application/x-www-form-urlencoded for -d payloads, while requests does not; the converter preserves the headers you actually passed.