← All articles

How to Convert cURL to Python Requests in Seconds

2026-09-25 · 5 min read

Advertisement

The problem

You have a working cURL command but need it in Python. Rewriting headers and payloads by hand is slow and error-prone.

Step 1 — Copy the cURL command

From Chrome DevTools: Network tab, right-click a request, then Copy as cURL. From docs, copy the example verbatim.

Step 2 — Paste it into the converter

Open the cURL to Python tool on tichi.shop and paste the command. Headers, method, cookies and body are detected automatically:

Advertisement
curl -X POST https://api.example.com/data \
  -H "Content-Type: application/json" \
  -d '{"name":"tichi"}'

Step 3 — Copy the Python output

You get ready-to-run code:

import requests

url = "https://api.example.com/data"
headers = {"Content-Type": "application/json"}
payload = {"name": "tichi"}

response = requests.post(url, headers=headers, json=payload)
print(response.status_code)
print(response.text)

Tips

  • Auth headers like Authorization: Bearer ... carry over automatically.
  • JSON bodies become Python dicts with None/True/False fixed.
  • Always test with a GET first before sending POST data.
Advertisement
Advertisement