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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file curlify2-2.0.0.tar.gz.

File metadata

  • Download URL: curlify2-2.0.0.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.2 Darwin/22.5.0

File hashes

Hashes for curlify2-2.0.0.tar.gz
Algorithm Hash digest
SHA256 6c3a98dc8603b76da990f58754b18ec4e9bfe5b881fc52d33ddf9d9096568809
MD5 25f4692a160980b56e7bd025cc89bedd
BLAKE2b-256 91243803baab3519ee855b6f6f6a81dca7af1ff8640bccb177765a227df9f835

See more details on using hashes here.

File details

Details for the file curlify2-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: curlify2-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.2 Darwin/22.5.0

File hashes

Hashes for curlify2-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 23878b13fa33ed92ae5dff0476e5b881b39fc79a5fcb37e6726f96239a136474
MD5 bdbfbd06adfcddaa2b16e92acf6b3549
BLAKE2b-256 43db8428ec3fa111a69db05de651ac7378b3b3eb8b558dd1cd7d262f4904c200

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