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.0.tar.gz
(3.7 kB
view details)
Built Distribution
curlr-0.1.0-py3-none-any.whl
(3.9 kB
view details)
File details
Details for the file curlr-0.1.0.tar.gz
.
File metadata
- Download URL: curlr-0.1.0.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd9bc78ff5c35363df374be49afd31a84520906d6def5286463de4eef82659f6 |
|
MD5 | 4b9d6d82d688bea0c84fff3ff384b2e8 |
|
BLAKE2b-256 | 26986b6b177483504358b4a8620801efb5d0c1f58fe4a13993f611897d793b2c |
File details
Details for the file curlr-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: curlr-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.9 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 | 5a50ecb903aa291b4bc7044acf81df70b7dd07f925d03cf82b0136869e78b25d |
|
MD5 | 3a040c449cd5d5d03fadafbe9bde4f65 |
|
BLAKE2b-256 | f0a0f325fc8f43a3dc530c69b261223904c8446e17a397aedcc5eb3335c6dbcc |