Registry / http-networking / curlify

curlify

JSON →
library3.0.0pypypi✓ verified 26d ago

Curlify is a Python library that converts `requests` request objects into equivalent cURL commands. This is particularly useful for debugging network requests by quickly generating a cURL command that can be executed directly in a terminal. The current version is 3.0.0, and it maintains an active release cadence, primarily focusing on Python version compatibility and minor enhancements.

pip install curlify
INSTALL
IMPORT
SIG · CURLIFY
C
curlify
http-networkingpythonv3.0.0
Install
2.1s avg
Import
Disk
19MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.0.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 21.1MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.1s · import 0.000s · 22MB
19MB installed
● package 19MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

to_curl
from curlify import to_curl
from curlify import curlify
quote
from curlify import quote

This quickstart demonstrates how to create a `requests.Request` object, prepare it using `.prepare()`, and then convert the resulting `PreparedRequest` object into a cURL command string using `curlify`.

import requests from curlify import curlify # Create a requests.Request object r = requests.Request( 'GET', 'http://httpbin.org/get', headers={'User-Agent': 'curlify-test-agent'}, params={'key': 'value'}, data={'body_key': 'body_value'} ) # Prepare the request to get a PreparedRequest object prepared_request = r.prepare() # Convert the prepared request to a curl command curl_command = curlify(prepared_request) print(f"Generated cURL command:\n{curl_command}")
curlify --version
Debug
Known issues
breakingPython 3.6 support was dropped in `curlify` version 3.0.0. Users on Python 3.6 or older will need to upgrade their Python version or stick to `curlify<3.0.0`.
fix
Upgrade Python to 3.7 or newer, or pin `curlify` to a version less than 3.0.0 (e.g., `pip install 'curlify<3.0.0'`).
affects: >=3.0.0
gotchaThe `curlify` function expects a `requests.PreparedRequest` object, not a raw `requests.Request` object or a `requests.Response` object. Passing the incorrect object type will result in an `AttributeError` or an incomplete cURL command.
fix
Always call the `.prepare()` method on your `requests.Request` object before passing it to `curlify`. For example: `prepared_req = requests.Request(...).prepare()` then `curlify(prepared_req)`.
affects: all
breakingIn `curlify` version 3.0.0 and newer, the library's primary function was renamed from `curlify` to `to_curl` and is imported as `from curlify import to_curl`. Attempting to import `curlify` directly (e.g., `from curlify import curlify`) will result in an `ImportError`.
fix
Update your import statement from `from curlify import curlify` to `from curlify import to_curl`, and then use `to_curl(...)` instead of `curlify(...)`.
affects: >=3.0.0
breakingThe `curlify` function's import path changed in version 3.0.0. It is now located at `from curlify.curlify import curlify`.
fix
Update your import statement from `from curlify import curlify` to `from curlify.curlify import curlify`.
affects: >=3.0.0
Upgrade
Version history
3.0.0latest on PyPI · released May 25, 2025
Audit
Dependencies
requestsrequiredCurlify operates on `requests` request objects; `requests` is a core dependency for its functionality.
Agent activity
25 hits · last 30 days
node
22
OpenAI (training)
1
Resources
curlify — pip install curlify · libregistry