curlr
curlr is a Python package that allows you to parse and execute cURL commands easily.
Installation
You can install curlr using pip:
pip install curlr
Usage
Here's a simple example of how to use curlr:
import requests
from curlr import CURL
# Using a cURL command string
curl_command = "curl -X POST -H 'Content-Type: application/json' -d '{\"key\":\"value\"}' https://api.example.com/endpoint"
curl = CURL(command=curl_command)
# Or using a file containing the cURL command
# curl = CURL(path="path/to/curl.txt")
# Get a prepared request
request = curl.request()
# Execute the request
response = curl.execute()# equivalent to: requests.Session().send(request)
# Or use individual properties
response = getattr(requests, curl.method.lower())(
curl.url,
headers=curl.headers,
cookies=curl.cookies,
json=curl.data
)
print(response.status_code)
print(response.json())
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for curlr 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| curlr-0.1.2.tar.gz | 4.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| curlr-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.1 kB
Release files / curlr-0.1.2.tar.gz
| Download URL | curlr-0.1.2.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f7592930f23404ca2c2a75512cecf34f1b48e0828cb79b41ca0112d6abc9d01e
|
|
BLAKE2b-256 checksum How to use checksums |
defb3d59d2cb82dc785f1c3a36296fef9adcf8f5d8ac5270d206af05f4c7b544
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.5
|
Release files / curlr-0.1.2-py3-none-any.whl
| Download URL | curlr-0.1.2-py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
08b27e0026e9b2e40a7c49a4f56520973c8ff7c58c75871811c06218bfad8c94
|
|
BLAKE2b-256 checksum How to use checksums |
13882365458044934057efac255bf0aa7514112cb3cf0771860cb3743e6b0a7a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.5
|