Convert cURL to Python

    Paste any curl command below and get clean, ready-to-use Python code instantly. Conversion happens entirely in your browser.

    How to copy a curl command from DevTools

    Most browsers can export any network request as a ready-to-paste curl command.

    Chrome / Edge

    1. Open DevTools (F12 or Cmd/Ctrl + Shift + I)
    2. Go to the Network tab and reload the page
    3. Right-click a request → Copy → Copy as cURL

    Firefox

    1. Open the Network Monitor in DevTools
    2. Right-click a request → Copy Value → Copy as cURL
    3. Paste it in the input above

    Safari

    1. Enable the Develop menu in Settings → Advanced
    2. Open Web Inspector → Network tab
    3. Right-click a request → Copy as cURL

    Your data stays in your browser

    We never transmit, store, or log the curl commands you paste. All parsing and conversion happens client-side using JavaScript.

    Watch for secrets

    Curl commands copied from DevTools often contain cookies, bearer tokens, or API keys. Never share converted code without scrubbing those values first.

    Learn more about converting curl to Python

    Background, worked examples, and answers to common questions — the converter above does the work, this section explains how to make the most of the output.

    About converting curl to Python

    Convert curl to Python in seconds. The generated Python code uses the popular `requests` library — the de facto standard for HTTP work in Python — so the output is idiomatic, readable, and ready to paste into any script, notebook, or backend service. Headers, query parameters, JSON bodies, form data, basic and bearer authentication, file uploads, and proxy settings are all preserved exactly as they appear in your curl command. This converter is especially useful when you're following along with API documentation written for curl, debugging a request you copied from your browser's DevTools, or porting a shell script into a Python project.

    Output uses

    requests

    File extension: .py

    How to use the Python output

    1. 1Paste your curl command into the input above (or build one with the Visual Builder).
    2. 2Copy the generated Python snippet — it uses the `requests` library by default.
    3. 3Install requests if you don't have it: `pip install requests`.
    4. 4Save the snippet to a file (e.g. `request.py`) and run it with `python request.py`.
    5. 5Inspect `response.status_code`, `response.headers`, and `response.json()` to use the data.

    Common Python examples

    GET request

    Fetch data from a public API endpoint.

    curl
    curl https://api.github.com/repos/curl/curl
    Python
    // generating example...

    POST with JSON body

    Send structured data with the correct content type.

    curl
    curl -X POST https://api.example.com/users \
      -H "Content-Type: application/json" \
      -d '{"name":"Ada Lovelace","email":"[email protected]"}'
    Python
    // generating example...

    Bearer token authentication

    Pass an API key or OAuth token in the Authorization header.

    curl
    curl https://api.example.com/me \
      -H "Authorization: Bearer YOUR_API_TOKEN"
    Python
    // generating example...

    Common requests — try them in the converter

    See all common Python requests →

    Click any example to load it into the converter at the top of the page and instantly see the Python output.

    Frequently asked questions about curl to Python

    Related conversions

    Coming soon

    Features we're building next to make curlcode the most useful tool in your dev workflow.

    AI Explanation

    Soon

    Plain-English breakdown of headers, auth, body, and what the request actually does.

    Fix my curl

    Soon

    AI-assisted repair for malformed curl commands and quoting issues.

    Reverse conversion

    Soon

    Paste fetch, axios, or Python requests code and get the equivalent curl back.