Python Vault Client
A lightweight Python wrapper for HashiCorp Vault using the hvac library.
This utility class enables secure and simple authentication via AppRole, and allows easy retrieval of secrets from Vault using the KV v2 engine.
Features
- ✅ Simple AppRole-based authentication using role ID and secret ID
- ✅ Automatic environment variable support (
VAULT_ADDR,VAULT_ROLE_ID, etc.) - ✅ Built-in validation for successful authentication
- ✅ Easy integration into other Python projects or CI pipelines
- ✅ Read secrets directly from Vault’s KV v2 engine
- ✅ Configurable mount point and secret path
Installation
pip install python-vault
🔧 Configuration
Environment variables used by default (can be overridden via constructor):
VAULT_ADDR: Vault URLVAULT_ROLE_ID: AppRole role IDVAULT_SECRET_ID: AppRole secret IDVAULT_MOUNT: Vault KV engine mount path
📦 Example Usage
import json
from python_vault import VaultClient
vault = VaultClient()
secret_data = vault.read_secret("path/to/secret")
print(json.dumps(secret_data, indent=4))
You can also pass configuration explicitly:
import json
from python_vault import VaultClient
vault = VaultClient(
vault_addr="https://vault.mycompany.com",
vault_role_id="your-role-id",
vault_secret_id="your-secret-id",
vault_mount="kv"
)
secret_data = vault.read_secret("path/to/secret")
print(json.dumps(secret_data, indent=4))
🤝 Contributing
If you have a helpful tool, pattern, or improvement to suggest:
Fork the repo
Create a new branch
Submit a pull request
I welcome additions that promote clean, productive, and maintainable development.
🙏 Thanks
Thanks for exploring this repository!
Happy coding!
Metadata
Release files for python-vault 1.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| python_vault-1.1.2.tar.gz | 4.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| python_vault-1.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.3 kB
Release files / python_vault-1.1.2.tar.gz
| Download URL | python_vault-1.1.2.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
969225cb0c477eb51083db369e3bde174e05f9696d9f315ffa85d046486fc6d5
|
|
BLAKE2b-256 checksum How to use checksums |
42e989fff1e5ba5086c928c7f5f2d4ba5bf2a2f9932df8d220bb2aac2847a5e3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / python_vault-1.1.2-py3-none-any.whl
| Download URL | python_vault-1.1.2-py3-none-any.whl |
|---|---|
| Size | 4.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8ad1baae9ac88859e5a7d8e069027b2d70f0326ee20e3bbafaa69879a0c10ef6
|
|
BLAKE2b-256 checksum How to use checksums |
cc3ca8a33d95fc685b5bec066181270b0ba94994e7bc6cd7e039b4724ed3c113
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|