Vault – Using Python to access vault

Reading Time: < 1 minute

Last Updated: 8/21/2024

The following is part of the ongoing posts regarding Hasicorps Vault product.

Please install the vault module.

pip install hvac requests

Some code:

import hvac
import sys

# Authentication
client = hvac.Client(
    url='http://vault.sparelab.net:8200',
    token='dev-token',
)

# Reading a secret
read_response = client.secrets.kv.read_secret_version(path='my-secret-password')

References:
https://medium.com/@kerrache.massipssa/dynamic-secrets-hashicorp-vault-postgresql-and-python-40197b4a178e

This entry was posted in Python, Secrets, Vault. Bookmark the permalink.