TrennyClient for logging and verifying API keys
Project description
TrennyClient
Asynchronous Python client for interacting with the Trenny API.
Features
- API key verification
- Fetch service statistics
- Retrieve logs
- Automatic startup and shutdown pings
- Revoke API keys
- Async and efficient with
httpxandasyncio - Color-coded console output for easy debugging
Installation
pip install httpx colorama
Usage Example
import asyncio
from trenny_client import TrennyClient
async def main():
client = TrennyClient(apikey="YOUR_API_KEY")
is_valid = await client.verify()
print(f"API key valid: {is_valid}")
stats = await client.get_stats()
print("Stats:", stats)
logs = await client.get_logs()
print("Logs:", logs)
await client.close()
asyncio.run(main())
API Overview
TrennyClient(apikey: str, auto_ping: bool = True): # Initialize the client.
async ping(status: str): # Send a manual ping.
async verify(endpoint: str = "default") -> bool: # Verify your API key.
async get_stats() -> dict: # Get service stats.
async get_logs() -> dict: # Retrieve logs.
async revoke_key() -> dict: # Revoke your API key.
async close(): # Close the HTTP client session.
Notes
Uses asynchronous programming (asyncio, httpx).
Sends API key in the x-api-key HTTP header.
Automatically sends "started" and "stopped" pings by default.
Exceptions raised on network or authorization errors — use try/except.
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 trenny_client-0.1.0.tar.gz.
File metadata
- Download URL: trenny_client-0.1.0.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c9e0dd1092eaff143b22e95c58874146901eb0342927084619ed332c91881a1
|
|
| MD5 |
1206b67c42eade3f1a939fb2e7a441f9
|
|
| BLAKE2b-256 |
0d823ed0101953e24b0280036f6d5d2f3af9606004a616e7e9562c65256f8efc
|
File details
Details for the file trenny_client-0.1.0-py3-none-any.whl.
File metadata
- Download URL: trenny_client-0.1.0-py3-none-any.whl
- Upload date:
- Size: 2.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
928c18aadfabd1731d0458822e67d9129e3f2de7a00c7ba37e235b7dbb817a64
|
|
| MD5 |
57ac8f2cc29ace6a8741944e20a04700
|
|
| BLAKE2b-256 |
0017b5c98bc33a8442242a49d1f35584f8c906b0a7b0bc881bba3ddae823a25a
|