Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marcuxyz/curlify2
The library convert python 'requests' and 'httpx' object in curl command. Curlify2 is a enhancement of curlify.
https://github.com/marcuxyz/curlify2
curl python python-requests requests
Last synced: about 2 months ago
JSON representation
The library convert python 'requests' and 'httpx' object in curl command. Curlify2 is a enhancement of curlify.
- Host: GitHub
- URL: https://github.com/marcuxyz/curlify2
- Owner: marcuxyz
- License: mit
- Created: 2020-10-30T13:28:35.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2024-04-12T02:36:24.000Z (9 months ago)
- Last Synced: 2024-05-02T00:04:12.978Z (8 months ago)
- Topics: curl, python, python-requests, requests
- Language: Python
- Homepage:
- Size: 133 KB
- Stars: 27
- Watchers: 1
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
The library convert python 'requests' and 'httpx' object in curl command. Curlify2 is a enhancement of [curlify]('https://github.com/ofw/curlify').
## Installation
To install the library use pip or poetry command, see:
```bash
$ pip install curlify2
```or poetry:
```bash
$ poetry add curlify2
```## Usage
using **requests** module:
```python
from curlify2 import Curlify
import requestsURL = "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:
```python
from curlify2 import Curlify
import httpxURL = "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
```