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.2.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.2-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: python_vault-1.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 969225cb0c477eb51083db369e3bde174e05f9696d9f315ffa85d046486fc6d5
MD5 47e9b7f81fa48d2002ea508ad9beaf82
BLAKE2b-256 42e989fff1e5ba5086c928c7f5f2d4ba5bf2a2f9932df8d220bb2aac2847a5e3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: python_vault-1.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8ad1baae9ac88859e5a7d8e069027b2d70f0326ee20e3bbafaa69879a0c10ef6
MD5 54ad1f68ba3442d8da5541d1b306d915
BLAKE2b-256 cc3ca8a33d95fc685b5bec066181270b0ba94994e7bc6cd7e039b4724ed3c113

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