Registry / devops / curlify2

curlify2

JSON →
library2.0.0pypypi✓ verified 81d ago

Library to convert Python requests and httpx objects to curl command. Version 2.0.0 supports Python >=3.7 and provides functions to curlify request/response objects. Released on PyPI with active maintenance.

pip install curlify2
INSTALL
IMPORT
SIG · CURLIFY2
C
curlify2
devopspythonv2.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

Curlify
from curlify2 import Curlify
from curlify2 import to_curl
curlify
from curlify2 import curlify
from curlify2 import to_curl

Convert a requests PreparedRequest object to a curl command.

import requests from curlify2 import to_curl resp = requests.get('https://httpbin.org/get') print(to_curl(resp.request)) # Output: curl -X GET 'https://httpbin.org/get' -H 'User-Agent: python-requests/2.31.0' -H 'Accept-Encoding: gzip, deflate' -H 'Accept: */*' -H 'Connection: keep-alive'
Debug
Known issues
gotchato_curl expects a requests.PreparedRequest or httpx.Request object, not a Response object. Passing a Response will cause an AttributeError.
fix
Use to_curl(response.request) instead of to_curl(response).
affects: >=1.0.0
deprecatedIn version 2.0.0, the function `curlify` was renamed to `to_curl` to avoid confusion with the package name. The old name is deprecated and will be removed in a future release.
fix
Use from curlify2 import to_curl instead of from curlify2 import curlify.
affects: 2.0.0
gotchaIf the request body is too large (e.g., file uploads), the curl command may become unreadable or truncated. There is no built-in option to truncate or exclude body.
fix
Manually truncate body in the object before passing to to_curl, or use a custom implementation.
affects: >=1.0.0
Upgrade
Version history
2.0.0latest on PyPI · released Jun 9, 2023
Audit
Dependencies

No dependency data recorded yet.

Agent activity
9 hits · last 30 days
node
8
Resources
curlify2 — pip install curlify2 · libregistry