🔁 Convertisseur cURL vers Python — Générer du Code requests

Convert any cURL command to Python requests code instantly. Supports headers, POST body, auth, JSON. Free online curl to Python converter.

Paste your curl command and select the Python tab to get production-ready Python requests code. Handles all curl flags: -H headers, -d POST data, -u basic auth, -X methods, and JSON bodies. Copy and paste straight into your project.

How to Use

1

Paste your cURL command

Paste your full curl command (starting with "curl") into the input area. Multi-line commands with \ are supported.

2

Choose a language

Click a language tab: Python, JavaScript, PHP, or Go. The code updates instantly.

3

Copy the code

Click Copy to copy the generated code. It handles headers, auth, and JSON bodies.

Frequently Asked Questions

What is a cURL command? +
cURL is a command-line tool for making HTTP requests. Developers use it to test APIs, download files, and debug network requests. Format: curl [options] URL. Common flags: -X (method), -H (header), -d (data), -u (auth).
What languages are supported? +
This tool generates code for Python (requests library), JavaScript (fetch API), PHP (curl extension), and Go (net/http package). Each output is idiomatic and production-ready.
How do I convert a curl with headers? +
Include -H flags in your curl command, e.g.: curl -H "Authorization: Bearer token" -H "Content-Type: application/json" https://api.example.com. All headers are extracted and included in the generated code.
Does it support POST with JSON body? +
Yes. Include -d '{"key":"value"}' or --data-raw with your JSON. The tool detects JSON content and formats it properly for each language.
What about Basic Auth? +
curl -u username:password is supported and converted to the appropriate auth mechanism in each language: HTTPBasicAuth in Python, btoa() in JS, CURLOPT_USERPWD in PHP, and SetBasicAuth in Go.


Guide : Convertisseur cURL vers Code

Qu'est-ce que c'est ?

Le convertisseur cURL vers Code transforme les commandes cURL en code équivalent pour JavaScript (fetch, axios), Python (requests), PHP et d'autres langages.

Cela évite de réécrire manuellement les appels API copiés depuis la documentation ou DevTools.

Comment utiliser

  1. Collez votre commande cURL dans le champ d'entrée.
  2. Sélectionnez le langage cible (JavaScript, Python, PHP…).
  3. Le code équivalent s'affiche dans le panneau de sortie.
  4. Copiez et intégrez directement dans votre projet.

Conseils professionnels

🧰 50+ Tools