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.

Curl Command
Paste your curl command here
Python Output
Generated Python requests code
Paste a curl command on the left to see Python code here

Why Use This Curl to Python Converter

Private & Secure
Runs entirely in your browser. Your curl commands, API keys, and tokens never leave your machine. No server-side processing.
Instant Conversion
Real-time conversion as you type. No waiting for servers, no loading spinners. Paste and get your Python code immediately.
Full curl Support
Handles headers, cookies, POST data, JSON bodies, form uploads, basic auth, proxies, and multi-line commands with backslash continuation.
Introducing

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

  1. Open Chrome DevTools by pressing F12 or Ctrl+Shift+I (Cmd+Option+I on Mac).
  2. Go to the Network tab.
  3. Perform the action that triggers the HTTP request you want to capture.
  4. Right-click the request in the list and select Copy → Copy as cURL.
  5. 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.