This is a tool that converts curl commands into Python request elements. It provides a graphical user interface for easy use.
- Parse curl commands to extract URL, headers, cookies, and URL parameters
- Support for multi-line curl command format
- Copy and paste from clipboard
- Save conversion results to a file
- Simple and user-friendly graphical interface
- Clone or download this repository.
- Install the required packages:
pip install pyperclip==1.8.2Run the main application:
python curl_converter_app.py- Paste the curl command into the input box (supports pasting curl commands directly copied from browser developer tools).
- Click the "Convert" button.
- View the converted Python request elements in the output box.
- You can copy the result or save it to a file.
curl 'https://example.com/api/data' \
-H 'accept: application/json' \
-H 'content-type: application/json' \
-b 'session=abc123; user=user1'headers = {
"accept": "application/json",
"content-type": "application/json"
}
cookies = {
"session": "abc123",
"user": "user1"
}
url = "https://example.com/api/data"
method = "GET"- URL extraction
- Headers (
-Hor--header) - Cookies (
-bor--cookie) - Request method (
-Xor--request) - Data (
-dor--data) - URL parameter parsing
If you wish to extend the functionality of this tool, you can modify the curl_parser.py file to support more curl options.