Add your description here
Project description
winwin-vault
A read-only Python client for HashiCorp Vault, with automatic token renewal and dynamic secret caching.
Installation
pip install winwin-vault
Quick Start
from winwin_vault import VaultClient
# Uses VAULT_ADDR and auth method from environment
client = VaultClient.from_env()
# Read a KV v2 secret
secret = client.read_kv("config")
print(secret["api_key"])
# Read database credentials (cached with TTL)
creds = client.read_database_creds("my-role")
print(creds.username, creds.password)
# Read Alicloud STS credentials (cached with TTL)
alicreds = client.read_alicloud_creds("my-role")
print(alicreds.access_key, alicreds.secret_key, alicreds.security_token)
Authentication
VaultClient.from_env() auto-detects the auth method:
| Environment | Auth Method |
|---|---|
VAULT_TOKEN set |
EnvTokenAuth |
~/.vault-token present |
EnvTokenAuth |
| Kubernetes ServiceAccount | KubernetesAuth |
| Vault Agent socket | VaultAgentAuth |
TLS is enforced for all auth methods except VaultAgentAuth (which communicates over a local Unix socket).
Mount Points
Default mount points:
- KV v2:
secret - Database:
database - Alicloud:
alicloud
Change via setters:
client.set_kv_mount_point("internal")
client.set_database_mount_point("database")
client.set_alicloud_mount_point("alicloud")
Exception Handling
from winwin_vault import VaultClient, VaultClientError, VaultSecretNotFoundError
try:
secret = client.read_kv("config")
except VaultSecretNotFoundError:
print("Secret not found")
except VaultClientError as e:
print(f"Vault error: {e}")
License
MIT License — see LICENSE file to be added.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file winwin_vault-0.1.0.tar.gz.
File metadata
- Download URL: winwin_vault-0.1.0.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ed60027bd58161299761d95aea41ad03dae6a3d07ddd7bb4d67b5b943ffb208
|
|
| MD5 |
c337c33f280ebdbcad650726445d93ad
|
|
| BLAKE2b-256 |
a5c7e51a55f35b228b1e873247711db5256715ec83f32bc4f1707588f9a60342
|
File details
Details for the file winwin_vault-0.1.0-py3-none-any.whl.
File metadata
- Download URL: winwin_vault-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a5ecb837863382d05975f10091e817a53783a8ee42c069732357a0d2b0be2c46
|
|
| MD5 |
9f17bfc82299e5d28c916fdaf93ba381
|
|
| BLAKE2b-256 |
7626dcd3e66c47cde662d33304565ad6c3dc87a9f5efd8a532d6f95e431677bc
|