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

Uploaded Python 3

File details

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

File metadata

  • Download URL: python_vault-1.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 979ea8d20380ed89a76ff3e8a19128879cd74c952b197af2c85077e756d7051d
MD5 d0310086abf3265ce62c0619324cb527
BLAKE2b-256 36f5f8275eb87909cc5f8965de9a317f79bb938bdb8055dfa10440097a780e4d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: python_vault-1.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5f87983a3d9c45db654e58bcb706092a0738310d52f5e9833e00b6dc061f5bed
MD5 0cf606ee0e781964b55a062f2e3af06e
BLAKE2b-256 6de36888a78b48be2af50715b2a87cb3bfb153048c972affeab7412c63cd6cb4

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