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:
import curlify2
import requests
URL = "https://run.mocky.io/v3/b0f4ffd8-6696-4f90-8bab-4a3bcad9ef3f"
request = requests.get(URL)
curl = curlify2.to_curl(request.request)
print(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)
curl = curlify2.to_curl(request.request)
print(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-1.0.3.1.tar.gz
(2.4 kB
view hashes)
Built Distribution
Close
Hashes for curlify2-1.0.3.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59018ef55c4458d1a79565bdcee44f53f9e565d920d84ec16daf6a61bddd6d37 |
|
MD5 | 6ef5fbdb6e2b5994d007d1c8a7ee07ce |
|
BLAKE2b-256 | 305c9e459903f006ceaab2388193d72d74cc26b96ebf10ab94b32abd2048f103 |