A Python package to parse and execute cURL commands
Project description
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.
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
curlr-0.1.2.tar.gz
(4.3 kB
view details)
Built Distribution
curlr-0.1.2-py3-none-any.whl
(4.8 kB
view details)
File details
Details for the file curlr-0.1.2.tar.gz
.
File metadata
- Download URL: curlr-0.1.2.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7592930f23404ca2c2a75512cecf34f1b48e0828cb79b41ca0112d6abc9d01e |
|
MD5 | c8580f471b48434d95dec3ffab5513e6 |
|
BLAKE2b-256 | defb3d59d2cb82dc785f1c3a36296fef9adcf8f5d8ac5270d206af05f4c7b544 |
File details
Details for the file curlr-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: curlr-0.1.2-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08b27e0026e9b2e40a7c49a4f56520973c8ff7c58c75871811c06218bfad8c94 |
|
MD5 | 293aa2462f3fac2b95ce6cf44bc27112 |
|
BLAKE2b-256 | 13882365458044934057efac255bf0aa7514112cb3cf0771860cb3743e6b0a7a |