About this conversion
In this example, the cURL command with basic auth and a JSON body becomes a Python requests call. The -u credentials map to auth=('admin', 's3cr3t-hunter2'), the JSON payload maps to json=json_data (with true becoming True), and the POST verb maps to requests.post(url, headers=headers, json=json_data, auth=auth).
Key Syntax Transformations
json= instead of data=
When the body is JSON (by Content-Type, the --json flag, or shape), it is emitted as a json_data dictionary — requests serializes it and sets Content-Type for you.
auth=(user, pass) tuples
Basic auth from -u becomes the idiomatic requests auth tuple; the Authorization header is built at request time, not hand-encoded.
Python-native literals
JSON true/false/null are rewritten to True/False/None, and nested objects and arrays become dictionaries and lists with their structure preserved.
Standard verbs, standard functions
GET/POST/PUT/PATCH/DELETE map to their requests.get()/post()/… functions; exotic verbs fall back to requests.request("VERB", url, …).
Technical documentation
json= versus data= — chosen for you
Python's requests library has two body parameters, and picking the wrong one causes subtle bugs. json=payload serializes the object and sets Content-Type: application/json automatically, while data=payload sends form-encoded or raw bytes. The converter inspects the Content-Type header, the --json shorthand, and the body's shape, then picks the correct parameter — JSON bodies become a json_data dictionary, everything else becomes a data string.
Nested JSON survives faithfully: arrays become lists, objects become dictionaries, and the literals are rewritten to Python — true and false become True and False, null becomes None, and strings are escaped with Python-safe quoting.
Auth, headers, and cookies
Basic auth from -u (or credentials embedded in the URL) becomes the idiomatic auth=(username, password) tuple, letting requests build the Authorization header at runtime. Bearer tokens and API keys sent via -H pass straight through into the headers dictionary unchanged.
Convenience flags translate naturally: -A/--user-agent fills a User-Agent header, -e/--referer becomes Referer, and -b/--cookie becomes Cookie — so the generated headers dict matches what curl would have sent on the wire.
Running the generated Python code
The snippet targets Python 3.7+ with the requests library — install it once with pip install requests. Each generated script prints the response body, using response.json() for JSON APIs or response.text otherwise, so you can paste it into a REPL and iterate immediately.
Standard verbs map to their requests functions (requests.get, requests.post, requests.put, requests.patch, requests.delete, requests.head, requests.options), while unusual methods fall back to requests.request("VERB", url, …) — the same fallback requests itself documents.
Query strings, encoding, and edge cases
URLs keep their query strings verbatim — no params dictionary needed — and -G with data flags is merged into the URL exactly like curl does. --data-urlencode values are percent-encoded during conversion, and repeated -d flags are joined with & the same way curl joins them before sending.
Multi-line cURL commands with backslash continuations, ANSI-C $'…' quoting from Chrome DevTools, and escaped quotes inside JSON bodies are all normalized before conversion, so pasting straight from a terminal or the macOS pbpaste buffer just works.
Frequently Asked Questions
Is my cURL command uploaded anywhere?
No. Conversion is 100% client-side — the page is static HTML and JavaScript, and your command (including credentials and cookies) never leaves the browser.
When does the output use json= instead of data=?
json= is emitted when Content-Type is application/json, the --json flag is used, or an untyped body parses as valid JSON. Form pairs and raw text become data= with the original content type preserved.
Which Python version does the generated code require?
Python 3.7 or newer plus the requests library (pip install requests). Nothing else — the snippet uses only requests and the standard library.
Does the converter work offline?
Yes. Once the page has loaded, the transpiler needs no network — convenient for air-gapped machines and locked-down corporate laptops.
Are multi-line cURL commands supported?
Yes. Commands pasted with trailing backslash continuations — and ANSI-C $'…' quoting from Chrome DevTools — are normalized before parsing.
How are JSON booleans and null translated to Python?
Literals are rewritten during conversion: JSON true and false become Python True and False, and null becomes None. Nesting, lists, and dictionaries are preserved exactly.
How is basic auth converted for Python?
The -u flag becomes the requests auth=(username, password) tuple. If the command already carries an Authorization header (for example a bearer token), it is kept in the headers dict instead.
Does it handle custom HTTP methods?
Yes. Common verbs become requests.get/post/put/etc., and anything else is emitted as requests.request("VERB", url, …), which supports arbitrary methods.