sok.apis.base_api
Base API client implementation.
Provides the foundational BaseAPI class that all media API clients inherit from. Handles HTTP session management, request lifecycle, and connection pooling.
BaseAPI
class BaseAPI(api_key: str, base_url: str)Bases: MediaAPI
Common base class for all API implementations.
Provides shared functionality for HTTP requests, session management, and connection handling. All specific API implementations should inherit from this class.
Initialize the API client.
Parameters
| Name | Type | Description |
|---|---|---|
api_key | str | API authentication key. |
base_url | str | Base URL for all API requests. |
Attributes
| Name | Type | Description |
|---|---|---|
api_key | str | API authentication key. |
base_url | str | Base URL for API requests. |
api_nameproperty
str
Name of the service in error messages, from the class name.
sessionpropertywritable
Optional[aiohttp.ClientSession]
Get the HTTP session.
closeasync
async def close() -> None:Close the aiohttp session.
Safe to call multiple times. Errors during close are silently ignored.
Source