The Teensy Hvac is a wrapper for the hvac module giving a simpler interface. Thvac works only with token auth and kv2 secret engine.
import thvac
client = thvac.Client('https://vault:8200', 'token')
if not mount_create('mountpoint'):
raise Exception('Oops')
client.secret_write('mountpoint', 'path/to', {'password': 'fish})
if client.secret_get('mountpoint', 'path/to')['password] == 'fish':
client.secret_write('mountpoint', 'path/to', {'password': 'herring', 'fish': 'was here'})
Creates a new client.
Renews the client token.
Return: bool.
Returns: dict() with the secret data. If smth is wrong it always returns an empty dict().
Secret should be a dict().
Returns: bool. False only if an error has happended.
Lists all mountpoints list.
Returns: set().
Creates a new kv2 mountpoint.
Returns: bool, it always is True if there isn't any error.
I use hvac in my everyday work and the official client basically provides a lot of bricks for building youown local client for your tasks and evironment. And it's OK.
However I recon there is a little problem and I want to code a tiny client using hvac (not bare Vault API) with a simplier to use interface based on my expirience with Vault and hvac.
All assets and docs for developing and testing in the 'develop' folder. It uses docker-compose, the Vault docker image, and the Python image.
It is runned and developed on python 3.9 but I sure that another python version aren't a problem.