agoras.core package

The agoras.core package provides abstract interfaces, business logic, and shared infrastructure for all Agoras platform implementations.

Package Overview

This package provides: - Abstract SocialNetwork interface that all platforms must implement - Base API classes for platform API clients - Authentication infrastructure (OAuth2, token storage, callback server) - Feed management for RSS/Atom feed automation - Sheet management for Google Sheets scheduling

Dependencies: Requires agoras-common and agoras-media.

agoras.core package

agoras.core.interfaces module

Abstract interface that all social network platforms must implement.

agoras.core.api_base module

Base API class for platform API client implementations.

class agoras.core.api_base.BaseAPI(**credentials)[source]

Bases: ABC

Abstract base class for social network API implementations.

Provides common functionality and patterns for API interactions including authentication, rate limiting, and error handling.

abstract async authenticate()[source]

Authenticate with the API asynchronously.

Returns:

BaseAPI: Self for method chaining

Raises:

Exception: If authentication fails

abstract async delete(post_id, *args, **kwargs)[source]

Delete a post from the social media platform.

Args:

post_id (str): ID of the post to delete

Returns:

str: Post ID

Raises:

Exception: If deletion fails or not supported

abstract async disconnect()[source]

Disconnect from the API and clean up resources.

is_authenticated()[source]

Check if API is authenticated.

Returns:

bool: True if authenticated, False otherwise

abstract async like(post_id, *args, **kwargs)[source]

Like/react to a post on the social media platform.

Args:

post_id (str): ID of the post to like

Returns:

str: Post ID

Raises:

Exception: If liking fails or not supported

abstract async post(*args, **kwargs)[source]

Create a post on the social media platform.

Returns:

str: Post ID

Raises:

Exception: If posting fails

abstract async share(post_id, *args, **kwargs)[source]

Share/repost a post on the social media platform.

Args:

post_id (str): ID of the post to share

Returns:

str: Share/Post ID

Raises:

Exception: If sharing fails or not supported

agoras.core.auth package

OAuth2 authentication infrastructure for Agoras.

This package provides base classes and utilities for OAuth2 authentication across all social media platforms.

agoras.core.auth package

agoras.core.auth.base module

Base authentication manager for OAuth2 flows.

agoras.core.auth.storage module

Secure token storage for OAuth2 credentials.

agoras.core.auth.callback_server module

OAuth2 callback server for handling authorization redirects.

agoras.core.auth.exceptions module

Authentication-related exceptions.

exception agoras.core.auth.exceptions.AuthenticationError[source]

Bases: Exception

Raised when authentication is required but credentials are not available.

This exception is used to enforce the “Authorize First” workflow, requiring users to explicitly run the authorize action before attempting other actions.