The library is responsible for parsing a cURL request string and converting it into a Python dictionary containing the method, URL, headers, and data
Project description
Here's an example of how to use the curlconverter library:
from curlconverter import CurlConverter
Example cURL command string
curl_string = 'curl 'https://api.example.com\' -H 'Content-Type: application/json' -d '{"foo": "bar"}''
Create an instance of CurlConverter with the cURL string
curl_converter = CurlConverter(curl_string)
Convert the cURL string to a dictionary
parsed_data = curl_converter.convert()
Print the parsed data
print(parsed_data)
Output: {'method': 'GET', 'url': 'https://api.example.com', 'headers': {'Content-Type': 'application/json'}, 'data': '{"foo": "bar"}'}
In this example, we create an instance of CurlConverter with a cURL command string that makes a GET request to https://api.example.com with a Content-Type header and a JSON payload. We then call the convert() method on the instance to parse the cURL string and return a dictionary with the parsed data. Finally, we print the parsed data to the console.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file curlconverter-1.0.1.tar.gz.
File metadata
- Download URL: curlconverter-1.0.1.tar.gz
- Upload date:
- Size: 1.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.1 CPython/3.10.1 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5fab370db6e6216513338eecc9e211dbc04e48432d201e69b070d265d4b6426e
|
|
| MD5 |
5b6d7908e22ebff76bb9e28a2cd53dc6
|
|
| BLAKE2b-256 |
7fea807661af581b7b3b4b6b50d9157f73dfa4efe62607f04eb3db1aeef6121b
|
File details
Details for the file curlconverter-1.0.1-py3-none-any.whl.
File metadata
- Download URL: curlconverter-1.0.1-py3-none-any.whl
- Upload date:
- Size: 1.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.1 CPython/3.10.1 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
44df2bab14bf6460352d421155fdf73339564b7972bd32e3d7a38af25db4b6ea
|
|
| MD5 |
eff5d69ad07e54d41ee3f1900aff7c0a
|
|
| BLAKE2b-256 |
4cdebbdff74bec22f7db6f586b3baa8dc7e6938fb289a5eacf1d4e210d4af8cb
|