Skip to main content

A Python client for HashiCorp Vault with AppRole authentication and secret management.

Project description

PyPI version Python Development Status Maintenance PyPI License


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 URL
  • VAULT_ROLE_ID: AppRole role ID
  • VAULT_SECRET_ID: AppRole secret ID
  • VAULT_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

python_vault-1.1.0.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_vault-1.1.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file python_vault-1.1.0.tar.gz.

File metadata

  • Download URL: python_vault-1.1.0.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for python_vault-1.1.0.tar.gz
Algorithm Hash digest
SHA256 60c387b39f90e678782898ff7a974bef6b71db769d14960fa11390a7d41cbdd8
MD5 1e596788bdf4dec17d5038b4114b4969
BLAKE2b-256 435fc5c17fc3c06fdc96c5d02f60a0170723cbea293a199c48b333c18ba9bfa9

See more details on using hashes here.

File details

Details for the file python_vault-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: python_vault-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for python_vault-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9e8ccee2fb80d19ea79fab935478fff6aa7f8b2550dfdc2d212b3298640522cf
MD5 9ceff92641aecbc017307e1fce6720a7
BLAKE2b-256 a4e14cf6e7fb05c37a9ba4fafd0721827af130fab13a3b168584013cb551d243

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page