Skip to main content

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 httpx and asyncio
  • Color-coded console output for easy debugging

Installation

pip install trenny-client

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


Download files

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

Source Distribution

trenny_client-0.2.0.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

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

trenny_client-0.2.0-py3-none-any.whl (2.1 kB view details)

Uploaded Python 3

File details

Details for the file trenny_client-0.2.0.tar.gz.

File metadata

  • Download URL: trenny_client-0.2.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

Hashes for trenny_client-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f9a3771f3795b6025fcbf61b4e634ec055e68de92ce567e6b12d3efafe7b4880
MD5 3ae591cddc21c5b414cf9d63592efb86
BLAKE2b-256 dda437bad04348374ee10545aa043575a8731299e2fc66fab077509c0c449069

See more details on using hashes here.

File details

Details for the file trenny_client-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: trenny_client-0.2.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

Hashes for trenny_client-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2582b204280663dbcb0018bd5960c0234e97b11473581a4bd8242e2e4036f0a0
MD5 74e44a86b589987d956bf8f51c1d6ca5
BLAKE2b-256 e6483e1c43d81fe4a9b8404f5038edb306bfa8b0200436f4db0b83811e71949c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page