Skip to main content

Library to convert python requests and httpx object to curl command.

Project description

The library convert python 'requests' and 'httpx' object in curl command. Curlify2 is a enhancement of curlify.

Installation

To install the library use pip or poetry command, see:

$ pip install curlify2

or poetry:

$ poetry add curlify2

Usage

using requests module:

from curlify2 import Curlify
import requests

URL = "https://run.mocky.io/v3/b0f4ffd8-6696-4f90-8bab-4a3bcad9ef3f"

request = requests.get(URL)
response = Curlify(request.request)

print(response.to_curl()) # curl -X GET -H "User-Agent: python-requests/2.24.0" -H "Accept-Encoding: gzip, deflate" -H "Accept: */*" -H "Connection: keep-alive" -d 'None' https://run.mocky.io/v3/b0f4ffd8-6696-4f90-8bab-4a3bcad9ef3f

using httpx module:

import curlify2
import httpx

URL = "https://run.mocky.io/v3/b0f4ffd8-6696-4f90-8bab-4a3bcad9ef3f"

request = httpx.get(URL)
response = Curlify(request.request)

print(response.to_curl()) # curl -X GET -H "User-Agent: python-requests/2.24.0" -H "Accept-Encoding: gzip, deflate" -H "Accept: */*" -H "Connection: keep-alive" -d 'None' https://run.mocky.io/v3/b0f4ffd8-6696-4f90-8bab-4a3bcad9ef3f

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

curlify2-2.0.0.tar.gz (2.5 kB view hashes)

Uploaded Source

Built Distribution

curlify2-2.0.0-py3-none-any.whl (3.1 kB view hashes)

Uploaded Python 3

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