curlify

A library to convert python requests request object to curl command.

Latest version: 3.0.0 registry icon
Maintenance score
5
Safety score
100
Popularity score
14
Check your open source dependency risks. Get immediate insight about security, stability and licensing risks.
Security
  Vulnerabilities
Version Suggest Low Medium High Critical
3.0.0 0 0 0 0 0
2.2.1 0 0 0 0 0
2.2.0 0 0 0 0 0
2.1.1 0 0 0 0 0
2.1.0 0 0 0 0 0
2.0.1 0 0 0 0 0
2.0 0 0 0 0 0
1.2.1 0 0 0 0 0
1.2 0 0 0 0 0
1.1 0 0 0 0 0
1.0 0 0 0 0 0

Stability
Latest release:

3.0.0 - This version may not be safe as it has not been updated for a long time. Find out if your coding project uses this component and get notified of any reported security vulnerabilities with Meterian-X Open Source Security Platform

Licensing

Maintain your licence declarations and avoid unwanted licences to protect your IP the way you intended.

MIT   -   MIT License

Not a wildcard

Not proprietary

OSI Compliant



Curlify - convert Python Requests request object to cURL command

Installation

pip install curlify

Changes

v3.0.0

  • Remove Python 2 compatibility
  • Add pretty parameter to enable generating a multi-line command
  • Don't add -X when it's unnecessary
  • Correctly send empty headers
  • Don't generate --data that would read a file
  • Don't sort headers, their order is deterministic on Python 3.7+

v2.2.0

  • Fixed shell quotes. Fixed posting CSV file. Thanks to @leNEKO

v2.1.1

  • Add --insecure flag if verify parameter is not True

v2.1.0

  • Fixed body rendering when using json param to request function.

v2.0.1

  • Added compressed parameter to to_curl function, if it is needed to add --compressed option to generated cURL command.

v2.0

v1.2

  • Order of headers is deterministic (thanks to @tomviner)

Example

import curlify
import requests

response = 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/'