cURL to Python Requests Converter
Convert a curl command to Python requests or httpx code: params, headers, json= or data=, files= for forms, auth, cookies, timeouts, redirects and verify.
--compressed needs nothing extra: requests asks for gzip/deflate and decompresses automatically.
Copy a request from your browser's developer tools or an API's documentation as curl, paste it here, and get Python code that sends the same request with requests or httpx. The query string becomes a params dict, headers and cookies become dicts, JSON bodies become Python dicts passed with json=, form data becomes a data dict, -F uploads become files= tuples, and -u, -k, -m, -x and -L become auth, verify, timeout, proxies and redirect settings.
How to use this tool
- Paste the curl command (bash or Windows cmd style).
- Choose requests or httpx.
- Decide whether the query string should move into params=.
- Copy the code and run it; check the notes for anything that needs attention.
Formula
curl -X M URL -H "K: V" -d BODY → requests.m(url, headers={...}, data=… / json=…)
Body mapping: JSON (Content-Type …json) → json=, x-www-form-urlencoded pairs → data= dict, other text → data= (content= in httpx), -F fields → files= with (filename, open(path, "rb"), type) for files and (None, value) for text so the request stays multipart. curl follows redirects only with -L: requests follows by default, so allow_redirects=False is added without -L; httpx never follows unless follow_redirects=True, which -L adds.
Example
The sample GET becomes requests.get(url, params={"q": "coffee", "page": "2"}, headers={…}, cookies={"session": "abc123", "theme": "dark"}, timeout=30). -L needs no argument because requests follows redirects by default, and --compressed needs none because requests already asks for gzip and decompresses it.
Frequently asked questions
requests or httpx?
requests is the long-standing standard for synchronous code. httpx has almost the same API, plus async support and HTTP/2; it does not follow redirects unless told to.
Why is my JSON sent with json= instead of data=?
json= serializes the dict and sets Content-Type: application/json for you, which is easier to edit. If the server checks a signature over the exact bytes, send the original text with data= and keep the header.
Does it run the command?
No. The command is only parsed as text in your browser; nothing is sent.
Sources
Last updated:
Page address with these inputs: https://kakao.mobile/tools/curl-to-python-tool/
Cite or embed this tool
kakaoCalc. (2026, November 8). cURL to Python Requests Converter. https://kakao.mobile/tools/curl-to-python-tool/
“cURL to Python Requests Converter.” kakaoCalc, 8 Nov. 2026, kakao.mobile/tools/curl-to-python-tool/.
Paste this code into your page. The widget runs in your visitors' browsers, shows no ads and keeps a link back to this page. Embedding terms