sok.config.session_manager
Session Manager - Centralized management of sessions and API keys.
This module provides utilities for retrieving sessions and API keys from configuration.
Functions
get_api_key
def get_api_key(config: ConfigManager, service_id: str) -> str:Retrieve the API key for a service from config or environment.
Parameters
| Name | Type | Description |
|---|---|---|
config | ConfigManager | ConfigManager instance. |
service_id | str | Service identifier. |
Returns
strAPI key string or empty string if not found.
get_igdb_token
def get_igdb_token(config: ConfigManager) -> Optional[str]:Extract the IGDB token from the config.
Parameters
| Name | Type | Description |
|---|---|---|
config | ConfigManager | ConfigManager instance. |
Returns
Optional[str]IGDB access token string or None if not found.
get_session_data
def get_session_data( config: ConfigManager, service_id: str,) -> Optional[Dict[str, Any]]:Extract session data for a service from the config.
Works for all services (tmdb, lastfm, tvdb, etc.).
Parameters
| Name | Type | Description |
|---|---|---|
config | ConfigManager | ConfigManager instance. |
service_id | str | Service identifier (tmdb, tvdb, lastfm, etc.). |
Returns
Optional[Dict[str, Any]]Dictionary containing session data or None if not found.
get_spotify_token
def get_spotify_token(config: ConfigManager) -> Optional[str]:Extract the Spotify token from the config.
Parameters
| Name | Type | Description |
|---|---|---|
config | ConfigManager | ConfigManager instance. |
Returns
Optional[str]Spotify access token string or None if not found.
get_tmdb_session_id
def get_tmdb_session_id(config: ConfigManager) -> Optional[str]:Extract the TMDB session_id from the config.
Parameters
| Name | Type | Description |
|---|---|---|
config | ConfigManager | ConfigManager instance. |
Returns
Optional[str]TMDB session ID string or None if not found.
get_tvdb_token
def get_tvdb_token(config: ConfigManager) -> Optional[str]:Extract the TVDB token from the config.
Parameters
| Name | Type | Description |
|---|---|---|
config | ConfigManager | ConfigManager instance. |
Returns
Optional[str]TVDB token string or None if not found.