Skip to main content

naturalis-vault

OpenBao Vault client library for Naturalis.

  • Vault: reads secrets from Vault KV v2, given a token
  • refresh_vault_token: obtains a token via OIDC authentication

The library never writes tokens or secrets to your filesystem. Token persistence across different sessions is up to the user.

Installation

# UV
uv add naturalis-vault

# pip
pip install naturalis-vault

Usage

from naturalis.vault import Vault, refresh_vault_token

# Obtain a token (opens browser for OIDC login)
token = refresh_vault_token()

# Retrieve a secret
vault = Vault(
    secret_path="team/project/production",
    token=token,
)

api_key = vault.get_secret("IMPORTANT_API_KEY")

To avoid having to log in on every run, store the token yourself. The package automatically retrieves the VAULT_TOKEN environment variable if it was set.

vault = Vault(
    secret_path="team/project/production",
)

Or even monitor the token's last refresh date and regenerate it automatically:

import os
from datetime import date

today = str(date.today())
token = os.getenv("VAULT_TOKEN")

# Consider the vault token to be fresh if it was last refreshed today
if os.getenv("VAULT_TOKEN_LAST_REFRESH") != today and token:
    token = refresh_vault_token()
    os.environ["VAULT_TOKEN"] = token
    os.environ["VAULT_TOKEN_LAST_REFRESH"] = today

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

naturalis_vault-0.3.2.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

naturalis_vault-0.3.2-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file naturalis_vault-0.3.2.tar.gz.

File metadata

  • Download URL: naturalis_vault-0.3.2.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for naturalis_vault-0.3.2.tar.gz
Algorithm Hash digest
SHA256 f844a4eddd37850047b334221802caf9ef0d9e8c69ab8d56d866bfd62c71c52e
MD5 b8c385602844a1893f2e13bd44d77dc1
BLAKE2b-256 edc17ac2611ef5a24dadb4d77a89933bc0d2769599d18525a1e6745c9bfbc08b

See more details on using hashes here.

File details

Details for the file naturalis_vault-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: naturalis_vault-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for naturalis_vault-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a4d8a84bd2c8ac9f5d7d8a38ba885f97b82f933ef86248226ab80432d12b56fd
MD5 56b02dfaf9a9cc9beea783cb02759eb2
BLAKE2b-256 a31cdf64bdb94ae42686e6922440a4ac02bcdcc471d3cc53bc8395c77f1e5ac6

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.3.2 This release

2 files

0.3.1

2 files

0.3.0

2 files

0.2.0

2 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