Curl to Python Converter
Convert curl commands to Python requests code instantly. Paste a curl command copied from Chrome DevTools, API docs, or your terminal and get clean, ready-to-run Python code. Everything runs in your browser — no data leaves your machine.
Why Use This Curl to Python Converter
Meet the RunCell Jupyter AI Agent
Your on-demand copilot built for data scientists. Automate routine notebook tasks, explore data faster, and ship insights without leaving Jupyter.
- Generate and refactor notebook code with context awareness.
- Ask questions about your data, charts, and results inline.
- Collaborate securely—no datasets leave your environment.
How to Convert Curl to Python
How It Works
This converter parses your curl command directly in the browser using a custom tokenizer that handles shell quoting, backslash continuation, and all common curl flags. It extracts the HTTP method, URL, headers, cookies, request body, authentication, and other options, then generates clean Python code using the requests library.
Supported Features
- HTTP methods: GET, POST, PUT, DELETE, PATCH, HEAD
- Custom headers (
-H) - Request body (
-d,--data,--json) - Form uploads (
-F) - Cookies (
-b, Cookie header) - Basic authentication (
-u) - Proxy support (
-x) - SSL skip (
-k) - Multi-line curl with backslash continuation
How to Copy a Curl Command from Chrome DevTools
- Open Chrome DevTools by pressing F12 or Ctrl+Shift+I (Cmd+Option+I on Mac).
- Go to the Network tab.
- Perform the action that triggers the HTTP request you want to capture.
- Right-click the request in the list and select Copy → Copy as cURL.
- Paste the copied curl command into the converter above to get Python code.
Manual Conversion: Curl to Python Requests
If you prefer to convert manually, the Python requests library maps closely to curl options. A basic curl URL becomes requests.get(url). Headers set with -H 'Key: Value' become a headers dict. POST data with -d becomes the data parameter, or json if sending JSON. Authentication with -u user:pass becomes auth=(user, pass). This tool automates all of these mappings so you can focus on writing your application logic.
Common Use Cases
- Reproduce API calls from browser DevTools in Python scripts
- Convert API documentation examples to working Python code
- Debug REST APIs by converting curl test commands to Python
- Automate HTTP requests captured from Postman or Insomnia exports
- Build Python scrapers from curl commands
Privacy & Security
Your curl commands often contain sensitive data like API keys, authentication tokens, and session cookies. This converter processes everything in your browser using client-side JavaScript. No data is sent to any server or third-party service, so your credentials remain completely private.
More Developer Tools
Explore other free browser-based developer tools from RunCell.
Curl to Python Frequently Asked Questions
How do I convert a curl command to Python?
Paste your curl command into the input box on this page. The converter instantly parses all curl options — headers, cookies, data, authentication — and generates equivalent Python requests code. Copy it to your clipboard or download as a .py file.
What curl options are supported?
The converter handles -X (method), -H (headers), -d/--data (request body), -b (cookies), -u (basic auth), -F (form data), --json (JSON body), -k (insecure), -L (follow redirects), and --proxy. Multi-line curl commands with backslash continuation are also supported.
How do I copy a curl command from Chrome DevTools?
Open Chrome DevTools (F12), go to the Network tab, right-click any request, and select Copy → Copy as cURL. Then paste it into the converter above to get the equivalent Python requests code.
Is my data safe when using this converter?
Yes. The converter runs entirely in your browser using client-side JavaScript. No data is sent to any server. Your curl commands, API keys, tokens, and request data stay on your machine.
What Python library does the generated code use?
The generated code uses the Python requests library, which is the most popular HTTP library for Python. Install it with pip install requests if you don't have it already.