Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ofw/curlify
A library to convert python requests request object to curl command.
https://github.com/ofw/curlify
Last synced: 5 days ago
JSON representation
A library to convert python requests request object to curl command.
- Host: GitHub
- URL: https://github.com/ofw/curlify
- Owner: ofw
- License: mit
- Created: 2016-08-15T12:32:29.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-02-22T22:54:46.000Z (almost 2 years ago)
- Last Synced: 2024-12-30T23:15:15.880Z (12 days ago)
- Language: Python
- Size: 26.4 KB
- Stars: 394
- Watchers: 6
- Forks: 31
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
- License: LICENSE
Awesome Lists containing this project
- starred-awesome - curlify - A library to convert python requests request object to curl command. (Python)
README
# Curlify - convert python requests request object to cURL command
## Installation
```sh
pip install curlify
```## Changes
### v.2.2.0
* Fixed shell quotes. Fixed posting CSV file. Thanks to @leNEKO### v.2.1.1
* Add `--insecure` flag if `verify` parameter is not `True`### v.2.1.0
* Fixed body rendering when using `json` param to request function.### v.2.0.1
* Added `compressed` parameter to `to_curl` function, if it is needed to add `--compressed` option to generated cURL command.### v.2.0
* Skip `-d` option if request body is empty https://github.com/ofw/curlify/issues/6
* Minor changes to header sorting### v.1.2
* Order of headers is deterministic (thanks to @tomviner)## Example
```py
import curlify
import requestsresponse = requests.get("http://google.ru")
print(curlify.to_curl(response.request))
# curl -X 'GET' -H 'Accept: */*' -H 'Accept-Encoding: gzip, deflate' -H 'Connection: keep-alive' -H 'User-Agent: python-requests/2.18.4' 'http://www.google.ru/'print(curlify.to_curl(response.request, compressed=True))
# curl -X 'GET' -H 'Accept: */*' -H 'Accept-Encoding: gzip, deflate' -H 'Connection: keep-alive' -H 'User-Agent: python-requests/2.18.4' --compressed 'http://www.google.ru/'
```