Audit-Log-as-a-Service client library
Project description
LogVault Python SDK
Official Python client for LogVault — Audit-Log-as-a-Service for B2B SaaS. SOC 2, GDPR, and ISO 27001 compliant. Hosted in the EU.
Installation
pip install logvault
Quick Start
from logvault import Client
client = Client("your-api-key")
# Log an audit event
event = client.log(
action="user.login",
user_id="user_123",
resource="auth",
metadata={"ip": "192.168.1.1", "method": "password"}
)
print(f"Logged: {event['id']}")
Features
- Sync & Async — Both
ClientandAsyncClientavailable - Automatic Retries — Exponential backoff with jitter
- Input Validation — Action format and payload size checks
- Error Handling — Typed exceptions for auth, rate limits, validation
- Replay Protection — Optional nonce support
Usage
Async Client
import asyncio
from logvault import AsyncClient
async def main():
async with AsyncClient("your-api-key") as client:
event = await client.log(
action="document.create",
user_id="user_456",
resource="document:789",
metadata={"title": "Q4 Report"}
)
asyncio.run(main())
List Events
# Get recent events
response = client.list_events(page=1, page_size=50)
for event in response['events']:
print(f"{event['timestamp']} - {event['action']}")
# Filter by user or action
user_events = client.list_events(user_id="user_123")
login_events = client.list_events(action="user.login")
Error Handling
from logvault import Client, AuthenticationError, RateLimitError, APIError
client = Client("your-api-key")
try:
event = client.log(action="user.login", user_id="user_123")
except AuthenticationError:
print("Invalid API key")
except RateLimitError as e:
print(f"Rate limited. Retry after {e.retry_after}s")
except APIError as e:
print(f"API error: {e.status_code}")
Configuration Options
client = Client(
api_key="your-api-key",
base_url="https://api.logvault.eu", # Default
timeout=30, # Request timeout (seconds)
enable_nonce=True, # Replay protection
max_retries=3 # Retry attempts
)
Action Format
Actions follow the pattern entity.verb:
| Category | Examples |
|---|---|
| Auth | user.login, user.logout, user.password_reset |
| Documents | document.create, document.read, document.delete |
| Permissions | permission.grant, permission.revoke, role.assign |
| Data | data.export, data.delete |
Requirements
- Python 3.8+
requests(sync client)aiohttp(async client)
Links
License
MIT — see LICENSE for details.
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 logvault-0.2.5.tar.gz.
File metadata
- Download URL: logvault-0.2.5.tar.gz
- Upload date:
- Size: 10.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ea02d8359da6650aba9e38d5c3675c6f4fdfa7764d816589173bf0f240a47d5
|
|
| MD5 |
46da4eba569c2de5eebbdf91de8e1b9b
|
|
| BLAKE2b-256 |
a1d3d0a05c526c3fd6445965bafd72e65bfa60f45ff7bedc083b0869f331dcd6
|
Provenance
The following attestation bundles were made for logvault-0.2.5.tar.gz:
Publisher:
publish.yml on Rul1an/logvault-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
logvault-0.2.5.tar.gz -
Subject digest:
0ea02d8359da6650aba9e38d5c3675c6f4fdfa7764d816589173bf0f240a47d5 - Sigstore transparency entry: 732071782
- Sigstore integration time:
-
Permalink:
Rul1an/logvault-python@98434eb40865118531d317dce2a6e3bd041383ca -
Branch / Tag:
refs/tags/v0.2.5 - Owner: https://github.com/Rul1an
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@98434eb40865118531d317dce2a6e3bd041383ca -
Trigger Event:
release
-
Statement type:
File details
Details for the file logvault-0.2.5-py3-none-any.whl.
File metadata
- Download URL: logvault-0.2.5-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
adadf967d2529ef9e59b1d8eca964c4f97c0ce01af27e551b20e2a2d1b60db97
|
|
| MD5 |
e019ff8506bd7379e86cf4d2f5bdfc16
|
|
| BLAKE2b-256 |
cf6e8319c3bd7e603c699eb787004a1f7a3f5677b652e064d1c33b674468035d
|
Provenance
The following attestation bundles were made for logvault-0.2.5-py3-none-any.whl:
Publisher:
publish.yml on Rul1an/logvault-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
logvault-0.2.5-py3-none-any.whl -
Subject digest:
adadf967d2529ef9e59b1d8eca964c4f97c0ce01af27e551b20e2a2d1b60db97 - Sigstore transparency entry: 732071784
- Sigstore integration time:
-
Permalink:
Rul1an/logvault-python@98434eb40865118531d317dce2a6e3bd041383ca -
Branch / Tag:
refs/tags/v0.2.5 - Owner: https://github.com/Rul1an
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@98434eb40865118531d317dce2a6e3bd041383ca -
Trigger Event:
release
-
Statement type: