Skip to main content

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

Release files for curlify 3.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for curlify 3.0.0
File Size Uploaded
curlify-3.0.0.tar.gz 3.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for curlify 3.0.0
File Interpreter ABI Platform
curlify-3.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.2 kB

Release files / curlify-3.0.0.tar.gz

Download URL curlify-3.0.0.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
7b488ff3c924dba3433a1cc74044c0942da21f0a97fa26c3138319ba640ca412
BLAKE2b-256 checksum
How to use checksums
62dfe9c2720d32c5de985ce64d5dedf883b52c26ff5e9aa2ba2becea00098320
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.0

Release files / curlify-3.0.0-py3-none-any.whl

Download URL curlify-3.0.0-py3-none-any.whl
Size 3.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
52060c0eb7a656b7bde6b668c32f337bed4d736ce230755767e3ada56a09c338
BLAKE2b-256 checksum
How to use checksums
9ef8912ebddbff8ea603d4c90fa31557096f927b17efd30a166ce7ac1242910a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.0

Release history Release notifications | RSS feed

This release

3.0.0 This release

2 release files

2.2.1

1 release file

2.2.0

1 release file

2.1.1

1 release file

2.1.0

1 release file

2.0.1

1 release file

2.0

1 release file

1.2.1

1 release file

1.2

1 release file

1.1

1 release file

1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page