Official Python SDK for Calvery Vault secret manager
Project description
calvery
Official Python SDK untuk Calvery Vault — secret manager untuk tim developer.
Install
pip install calvery
Python 3.8+.
Quick start
import os
from calvery import Calvery
c = Calvery(token=os.environ["CVSM_TOKEN"], team="acme-corp")
# Ambil satu secret
db_url = c.get("DATABASE_URL")
# Ambil semua sebagai dict
secrets = c.get_all()
# Inject ke os.environ
c.inject()
print(os.environ["DATABASE_URL"]) # sudah terisi
API
Calvery(token, team, **opts)
| Arg | Type | Default | Keterangan |
|---|---|---|---|
token |
str | wajib | Personal Access Token (cvsm_...) |
team |
str | wajib | Team slug atau UUID |
base_url |
str | https://api.calvery.xyz |
Override untuk self-host |
environment |
str | "production" |
Default env kalau tidak di-override |
cache_ttl |
float | 30.0 |
Cache TTL (detik). Set 0 untuk disable |
max_retries |
int | 3 |
Retry 5xx + network error |
timeout |
float | 10.0 |
HTTP timeout per attempt |
c.get(name, *, environment=None) -> str
val = c.get("STRIPE_KEY")
staging = c.get("STRIPE_KEY", environment="staging")
Raise CalverySecretNotFoundError kalau secret tidak ada.
c.get_all(*, environment=None) -> dict[str, str]
for k, v in c.get_all().items():
print(k, v)
c.inject(*, environment=None, overwrite=False) -> list[str]
Inject semua secret ke os.environ. Default tidak overwrite env yang sudah ada.
c.clear_cache()
Manual clear cache tanpa nunggu TTL.
Patterns
Django settings.py
from calvery import Calvery
c = Calvery(token=os.environ["CVSM_TOKEN"], team="acme")
c.inject()
DATABASE_URL = os.environ["DATABASE_URL"]
SECRET_KEY = os.environ["DJANGO_SECRET_KEY"]
FastAPI startup
from contextlib import asynccontextmanager
from fastapi import FastAPI
from calvery import Calvery
@asynccontextmanager
async def lifespan(app: FastAPI):
Calvery(token=os.environ["CVSM_TOKEN"], team="acme").inject()
yield
app = FastAPI(lifespan=lifespan)
Jupyter / data science
from calvery import Calvery
c = Calvery(token="cvsm_...", team="data-team", environment="staging")
db_conn_string = c.get("WAREHOUSE_URL")
Error handling
from calvery import Calvery, CalveryAuthError, CalverySecretNotFoundError
try:
val = c.get("FOO")
except CalveryAuthError:
# Token expired / revoked
...
except CalverySecretNotFoundError:
# Secret belum dibuat
...
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file calvery-0.1.0.tar.gz.
File metadata
- Download URL: calvery-0.1.0.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cbb5ed030b52baa9a8fc5e747e9be12d852e404fc05d1d9f6d7348165cd20b82
|
|
| MD5 |
3a50a8d147eec0cc0949e7256434a37c
|
|
| BLAKE2b-256 |
1d9de62b13c4ad48528ae8be887be102915bfdf966fc743f65930d4bf86b00bc
|
File details
Details for the file calvery-0.1.0-py3-none-any.whl.
File metadata
- Download URL: calvery-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5fd23bc770abcdb8bb8ece56639434b08d917ebbc06ed45671ead884229fb9ec
|
|
| MD5 |
1df50ab3ba364dd9b81e5a03b77cf40f
|
|
| BLAKE2b-256 |
16aec724375f7b96ac23978e6e7acb6a31e0f584fef7987799e88d1a3adb77a4
|