A Python client for HashiCorp Vault with AppRole authentication and secret management.
Project description
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!
Project details
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 python_vault-1.0.1.tar.gz.
File metadata
- Download URL: python_vault-1.0.1.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
84e78dc846419d96ca76432be288ca58c8ccc02ec17bce50b5bc92d30eed907b
|
|
| MD5 |
f444b7af3f59dca2636b776bce31976d
|
|
| BLAKE2b-256 |
dd05eea8017f513dedc16d20584745585495a03b093d649c67381f8f5d4d1a0d
|
File details
Details for the file python_vault-1.0.1-py3-none-any.whl.
File metadata
- Download URL: python_vault-1.0.1-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8aa52939419a00e948c0eb7d73a73134e5284ddc93544d4b720b785043594cb6
|
|
| MD5 |
45e23b78073715ace6f94dffcbf88226
|
|
| BLAKE2b-256 |
7336ad90d986583f4d783dd33f20b1318a929b8ba8aa77541f15b97af8593f8c
|