Athena Client

A high-performance Python client library for interacting with Athena API services for CSAM (Child Sexual Abuse Material) detection.

The Athena Client provides both synchronous and asynchronous interfaces for image classification, with built-in support for OAuth authentication, automatic token refresh, image preprocessing, and streaming responses.

Key Features

  • Async/Await Interface: High-performance asynchronous image classification

  • Connection Management: Automatic reconnection and resource cleanup

  • Error Handling: Comprehensive error types and recovery strategies

  • Image Processing Pipeline: Built-in resizing, compression, and optimization

  • OAuth Authentication: Automatic token acquisition and refresh with credential helper

  • Streaming Responses: Process large batches efficiently with async iterators

  • Type Safety: Full type hints throughout the codebase

Quick Start

import asyncio
from resolver_athena_client.client.channel import CredentialHelper, create_channel_with_credentials
from resolver_athena_client.client.athena_client import AthenaClient
from resolver_athena_client.client.athena_options import AthenaOptions

async def main():
    credential_helper = CredentialHelper(
        client_id="your-client-id",
        client_secret="your-client-secret",
        auth_url="https://crispthinking.auth0.com/oauth/token",
        audience="crisp-athena"
    )

    channel = await create_channel_with_credentials(
        host="your-athena-host",
        credential_helper=credential_helper
    )

    options = AthenaOptions(
        host="your-athena-host",
        deployment_id="your-deployment-id",
        affiliate="your-affiliate"
    )

    async with AthenaClient(channel, options) as client:
        # Your classification logic here
        pass

asyncio.run(main())

Documentation

Authentication Methods

The Athena Client supports two authentication approaches:

Development

This project uses modern Python development tools:

  • uv for fast dependency management

  • pytest for comprehensive testing

  • ruff for linting and formatting

  • pyright for type checking

  • pre-commit hooks for code quality

See the Development Guide guide for detailed setup instructions.

Support

  • Review the Examples for common usage patterns

  • Check the API Reference for detailed API documentation

  • See the gRPC protobuf definitions in the athena-protobufs repository for API details.

  • Report issues on GitHub

  • Follow development guidelines in Contributing to Athena Client

Indices and tables