Python client for audit logging services
Project description
Audit Log Client
Python client for interacting with audit logging services, supporting both synchronous and asynchronous usage.
Features
- Dual Mode: Sync and Async APIs
- Buffering: Configurable memory buffering
- Retry Mechanism: Exponential backoff retries
- Fallback Strategy: Local file storage on failure
- Query Support: Flexible log querying capabilities
Installation
pip install audit-log-client
Quick Start
Synchronous Client
from audit_log_client import SyncAuditLogClient, AuditLog, AuditAction, AuditTarget
client = SyncAuditLogClient(
base_url="http://audit.service/api",
api_key="your-api-key"
)
log = AuditLog(
action=AuditAction.UPDATE,
target_type=AuditTarget.USER,
user_id="admin",
description="User profile updated",
before={"name": "John"},
after={"name": "John Doe"}
)
client.log(log)
client.close()
Asynchronous Client
import asyncio
from audit_log_client import AsyncAuditLogClient, AuditLog, AuditAction, AuditTarget
async def main():
client = AsyncAuditLogClient(
base_url="http://audit.service/api",
api_key="your-api-key"
)
await client.initialize()
log = AuditLog(
action=AuditAction.CREATE,
target_type=AuditTarget.ORDER,
user_id="sales",
description="New order created"
)
await client.log(log)
await client.shutdown()
asyncio.run(main())
Documentation
Full documentation available at GitHub Wiki
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
License
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 audit_log_client-1.4.0.tar.gz.
File metadata
- Download URL: audit_log_client-1.4.0.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8421e0d67f769349da12c672f8d0cb0a82662cd11e855032564d5931b2f093a5
|
|
| MD5 |
64887b4b40238c38ff8df66f8b2a906c
|
|
| BLAKE2b-256 |
584281f7424c7a27d16132878b7be0318b8f930b82761dd70055d2146babc643
|
File details
Details for the file audit_log_client-1.4.0-py3-none-any.whl.
File metadata
- Download URL: audit_log_client-1.4.0-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9dd4c30e633bc4a48784a2b6510ad33f232a85d699f89d2f7f8c379a4d52897a
|
|
| MD5 |
6a93c315c91035087171a3d0e49b0b25
|
|
| BLAKE2b-256 |
cd802977b8e378be2ea24400881e090cde6e8a2c55909288f08a1b9cdf4b14a4
|