httpx-curlify
English | Русский
Convert HTTP requests from httpx.Request to curl commands. Useful for debugging, logging, and documenting API requests.
Installation
Requires Python 3.13 or later.
pip install cloudru-qa-httpx-curlify
Import the library as the module httpx_curlify.
Skills for AI agents
This library does not have its own skill yet. If your project uses other
libraries from this suite with skills for AI agents,
select and enable them from your project root (requires uv):
uvx library-skills
For Claude Code, add --claude.
Usage
Basic usage
Convert a GET request:
import httpx
from httpx_curlify import to_curl
request = httpx.Request("GET", "https://example.com/api/users")
curl_command = to_curl(request)
print(curl_command)
Output:
curl -X GET \
-H 'host: example.com' \
https://example.com/api/users
A POST request with JSON:
request = httpx.Request(
"POST",
"https://example.com/api/users",
json={"name": "John", "age": 30},
)
curl_command = to_curl(request)
print(curl_command)
Output:
curl -X POST \
-H 'host: example.com' \
-H 'content-length: 24' \
-H 'content-type: application/json' \
--json '{"name": "John", "age": 30}' \
https://example.com/api/users
A request with headers:
request = httpx.Request(
"GET",
"https://example.com/api/data",
headers={
"Authorization": "Bearer token123",
"X-Custom-Header": "custom-value",
},
)
curl_command = to_curl(request)
print(curl_command)
Masking sensitive data
Mask sensitive data in headers and JSON request bodies using glom syntax:
Mask headers:
request = httpx.Request(
"GET",
"https://example.com/api/data",
headers={
"Authorization": "Bearer secret_token",
"X-Api-Key": "api_key_value",
},
)
curl_command = to_curl(request, sanitize_keys=["authorization", "x-api-key"])
print(curl_command)
Output:
curl -X GET \
-H 'host: example.com' \
-H 'authorization: ****' \
-H 'x-api-key: ****' \
https://example.com/api/data
Mask JSON data:
request = httpx.Request(
"POST",
"https://example.com/api/login",
json={"username": "john", "password": "secret123"},
)
curl_command = to_curl(request, sanitize_keys=["password"])
print(curl_command)
Output:
curl -X POST \
-H 'host: example.com' \
-H 'content-type: application/json' \
--json '{"username": "john", "password": "****"}' \
https://example.com/api/login
Mask nested data:
request = httpx.Request(
"POST",
"https://example.com/api/data",
json={"user": {"name": "John", "password": "secret"}},
)
curl_command = to_curl(request, sanitize_keys=["user.password"])
print(curl_command)
Output:
curl -X POST \
-H 'host: example.com' \
-H 'content-type: application/json' \
--json '{"user": {"name": "John", "password": "****"}}' \
https://example.com/api/data
JSON formatting
Pass additional options to json.dumps:
request = httpx.Request(
"POST",
"https://example.com/api/data",
json={"name": "John", "age": 30},
)
curl_command = to_curl(request, json_dumps_kwargs={"indent": 2})
print(curl_command)
Output:
curl -X POST \
-H 'host: example.com' \
-H 'content-type: application/json' \
--json '{
"name": "John",
"age": 30
}' \
https://example.com/api/data
Development
This library is developed in the qa-libraries monorepo
alongside the other cloudru-qa-* libraries. You need uv, GNU Make
and checkmake;
run the commands from the repository root:
make sync # dependencies for all libraries from uv.lock
make test-httpx-curlify # tests for this library
make typecheck-httpx-curlify # mypy for this library
make lint-fix # safe Ruff fixes
make check # formatting, Ruff, mypy, and tests for the whole suite
Update snapshots with:
make test-httpx-curlify PYTEST_ARGS=--snapshot-update
Tests run on Python 3.13 and 3.14. Each version uses a separate environment:
make sync test-httpx-curlify PYTHON_VERSION=3.14.
Create a release with the Git tag httpx-curlify/v<version>. The tag version must match the version
in packages/httpx-curlify/pyproject.toml.
Metadata
Release files for cloudru-qa-httpx-curlify 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cloudru_qa_httpx_curlify-1.0.0.tar.gz | 10.4 kB | With provenance | Details for cloudru_qa_httpx_curlify-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cloudru_qa_httpx_curlify-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for cloudru_qa_httpx_curlify-1.0.0-py3-none-any.whl |
Total release size: 19.8 kB
Release files / cloudru_qa_httpx_curlify-1.0.0.tar.gz
| Download URL | cloudru_qa_httpx_curlify-1.0.0.tar.gz |
|---|---|
| Size | 10.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3314556069023e1beeb4f0ef7a18e591be9e68d4ea5b5b540f220c7947ae962a
|
|
BLAKE2b-256 checksum How to use checksums |
58b11df944d035bf0c11dfd28591bbfd9041368b71f3a7685649b2f68e3fad8e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.
Transparency logRelease files / cloudru_qa_httpx_curlify-1.0.0-py3-none-any.whl
| Download URL | cloudru_qa_httpx_curlify-1.0.0-py3-none-any.whl |
|---|---|
| Size | 9.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
32eeb45e3598991ffbf99466f7fb70708710867410e726af1dd087e975b80078
|
|
BLAKE2b-256 checksum How to use checksums |
cd127b5b115f8438649b45d201c796fa4e09f4f84964ee0df59fd1860df03aaa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.
Transparency logSecurity for cloudru-qa-httpx-curlify 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for cloudru_qa_httpx_curlify-1.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.