cURL to Python requests
Paste a cURL command, get equivalent Python code using requests (the default) or httpx (for async / HTTP/2). Handles headers, JSON bodies, basic auth, multipart uploads, query strings. Browser-only — useful when you need a focused Python answer rather than the multi-language general converter.
How to use the cURL to Python requests
Paste a cURL command (the format Chrome / Firefox / Safari produce via Copy as cURL all work). Pick a library. requests is the default — present in nearly every Python environment. httpx is interface-compatible plus adds async and HTTP/2. urllib is stdlib-only — useful when you can't add dependencies.
Converting cURL to Python
Copying a cURL command into Python means rebuilding it as a requests (or httpx) call — headers into a dict, the body into json= or data=, basic auth into auth=, a file upload into files=. It is mechanical work, but easy to get subtly wrong, especially around escaping and content-type handling.
This converts a cURL command into Python using requests, httpx (sync or async), or the urllib stdlib, handling headers, JSON and form bodies, auth, and multipart. It is the focused Python path; for JavaScript use the sibling cURL to JavaScript converter, for several languages the multi-language cURL converter, and to build a request from form inputs rather than convert one, the HTTP request builder.
Common use cases
- DevTools to script — turn a browser “Copy as cURL” into requests code.
- Async — emit httpx async code for concurrent calls.
- No dependencies — get a urllib version when you cannot pip install.
- Documentation — present an API call as idiomatic Python.
- Quick test — move a shell request into a Python REPL or script.