Skip to main content

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


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.1.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

curlr-0.1.1-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file curlr-0.1.1.tar.gz.

File metadata

  • Download URL: curlr-0.1.1.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

Hashes for curlr-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9e2bff40d8c35eb561cda89088e347faff674bfe30e92bf39902b3f76dda58ff
MD5 80e6206a6c135b1558a6cc3aa68f90f2
BLAKE2b-256 42ef862157b9489dbbe0e144541216df1b94808211417aa3cce22cddbf286521

See more details on using hashes here.

File details

Details for the file curlr-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: curlr-0.1.1-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

Hashes for curlr-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8dfca7fbdeda00b328fe5332c6d3ca491a7b4f4072da68bae747b49f6e087733
MD5 6165a8c0a9229aaeec2a790967deed2a
BLAKE2b-256 7a129bec3b45d544f6a29c5afe4c7990e3f2105d167885994a432f4e10f344b2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page