grow-hashicorp-vault (Python)
Python SDK for HashiCorp Vault by Grow Codes. Unofficial and community maintained; not affiliated with or endorsed by HashiCorp, Inc. or IBM. "HashiCorp Vault" is a trademark of HashiCorp, Inc. (an IBM company).
pip install grow-hashicorp-vault
from grow_hashicorp_vault import VaultClient, VaultConfig
# Reads GROW_HASHICORP_VAULT_URL, GROW_HASHICORP_VAULT_TOKEN, ... from the environment.
with VaultClient.from_env() as client:
print(client.health())
print(client.server_version())
The async client has the same methods:
import asyncio
from grow_hashicorp_vault import AsyncVaultClient
async def main() -> None:
async with AsyncVaultClient.from_env() as client:
print(await client.health())
asyncio.run(main())
Service modules hang off the client (the async client mirrors every one of them):
from grow_hashicorp_vault import AppRoleAuth, VaultClient
with VaultClient.from_env() as client:
client.auth.login(AppRoleAuth(role_id, secret_id), auto_renew=True) # TokenRenewer
client.kv().write("app/db", {"password": "s3cret"}) # KV v1/v2 auto-detected
print(client.kv().read("app/db").metadata)
ct = client.transit().encrypt("my-key", "hello") # transit
lease = client.database().get_credentials("readonly") # dynamic credentials
client.leases.manage(lease, on_expire=lambda: print("expired")) # LeaseManager
cert = client.pki().issue_certificate("web", "app.example.com") # PKI
token = client.wrapping.wrap({"one-time": "value"}, ttl_s=60).token # response wrapping
client.sys.write_policy("app", 'path "secret/data/app/*" { capabilities = ["read"] }')
if client.sys.capabilities_self("secret/data/app/db").allows("secret/data/app/db", "read"):
print("this token may read app/db") # capabilities
team = client.with_namespace("team-a") # Enterprise only
print(client.secrets(path="app").get_string("db")) # SecretsProvider
| Module | Accessor | Functions |
|---|---|---|
| Auth | client.auth |
login(TokenAuth / AppRoleAuth / KubernetesAuth / JwtAuth / UserpassAuth), lookup_self, renew_self, revoke_self, create_token, start_renewer (TokenRenewer) |
| KV | client.kv(mount), kv_v1, kv_v2 |
read, write, patch, delete, delete_versions, undelete, destroy, list, read_metadata, write_metadata, delete_metadata |
| Transit | client.transit(mount) |
create_key, read_key, list_keys, rotate_key, update_key_config, delete_key, encrypt, decrypt, rewrap, encrypt_batch, decrypt_batch, generate_data_key, hmac, sign, verify, hash, random_bytes |
| Database | client.database(mount) |
get_credentials → Lease, configure_connection, read_connection, delete_connection, create_role, read_role, delete_role |
| Leases | client.leases |
renew, revoke, revoke_prefix, lookup, manage (auto-renew + on_expire), stop_all |
| PKI | client.pki(mount) |
issue_certificate, sign_csr, revoke_certificate, read_ca_chain, read_certificate, list_certificates, tidy, tidy_status |
| System | client.sys |
health, seal_status, leader, version, capabilities_self, capabilities (→ Capabilities.allows), policies, secrets engines, auth methods, AppRole admin (create_app_role, read_role_id, generate_secret_id …) |
| Wrapping | client.wrapping |
wrap, unwrap, lookup_wrapping |
| Namespaces | client.with_namespace(ns) |
a view sending X-Vault-Namespace (Vault Enterprise only; OSS ignores the header) |
| Secrets | client.secrets(mount, path=…) |
the shared SecretsProvider (get, set, list, delete, metadata, load_env, watch …) |
| Testing | grow_hashicorp_vault.testing.lifecycle |
init, unseal, seal, init_status, wait_for_active (+ a… async forms) |
Durations are float seconds (…_s parameters, timedelta accepted); timestamps are aware UTC
datetimes; tokens, keys and passwords are Secret values.
- Python 3.10 or newer, typed (
py.typed),httpxbased, environment proxies ignored unless configured. - Retries with full-jitter backoff and
Retry-After, connect/request/total timeouts, cancellation, hooks and a silent-by-defaultlogginglogger namedgrow_hashicorp_vault. - Credentials are wrapped in
Secretand never appear inrepr(), logs or error messages. grow_hashicorp_vault.testingships in-memory fakes and the conformance runner.
Documentation: https://grow-codes-packages.github.io/hashicorp-vault/ · Source: https://github.com/grow-codes-packages/hashicorp-vault · Licence: Apache-2.0
Metadata
Release files for grow-hashicorp-vault 0.1.1
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 |
|---|---|---|---|---|
| grow_hashicorp_vault-0.1.1.tar.gz | 164.6 kB | Without provenance | Details for grow_hashicorp_vault-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| grow_hashicorp_vault-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for grow_hashicorp_vault-0.1.1-py3-none-any.whl |
Total release size: 280.9 kB
Release files / grow_hashicorp_vault-0.1.1.tar.gz
| Download URL | grow_hashicorp_vault-0.1.1.tar.gz |
|---|---|
| Size | 164.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5100b360ce01eb8c6bb047383654925bf4a62a4fd085b5d0d1a4ad2b0e8554d6
|
|
BLAKE2b-256 checksum How to use checksums |
b6a9f344760f8df62d58da8f7dde4ee8653bd1dae7a6a02244ded2d97537ed6b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / grow_hashicorp_vault-0.1.1-py3-none-any.whl
| Download URL | grow_hashicorp_vault-0.1.1-py3-none-any.whl |
|---|---|
| Size | 116.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4a974f991dfb43a7fe205f8d4d527df4f989103fe1e91e67534c1bc75e8834ca
|
|
BLAKE2b-256 checksum How to use checksums |
b99453a60c85454cbcbb3aac58b8e238bb5ad1b0ee03308d68f4c00fa0458de1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for grow-hashicorp-vault 0.1.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.