Skip to main content

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!

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)

Source distribution for python-vault 1.1.2
File Size Uploaded
python_vault-1.1.2.tar.gz 4.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for python-vault 1.1.2
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

1.1.2 This release

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page