Skip to content

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

NameTypeDescription
configConfigManagerConfigManager instance.
service_idstrService identifier.

Returns

  • strAPI key string or empty string if not found.
Source

get_igdb_token

def get_igdb_token(config: ConfigManager) -> Optional[str]:

Extract the IGDB token from the config.

Parameters

NameTypeDescription
configConfigManagerConfigManager instance.

Returns

  • Optional[str]IGDB access token string or None if not found.
Source

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

NameTypeDescription
configConfigManagerConfigManager instance.
service_idstrService identifier (tmdb, tvdb, lastfm, etc.).

Returns

  • Optional[Dict[str, Any]]Dictionary containing session data or None if not found.
Source

get_spotify_token

def get_spotify_token(config: ConfigManager) -> Optional[str]:

Extract the Spotify token from the config.

Parameters

NameTypeDescription
configConfigManagerConfigManager instance.

Returns

  • Optional[str]Spotify access token string or None if not found.
Source

get_tmdb_session_id

def get_tmdb_session_id(config: ConfigManager) -> Optional[str]:

Extract the TMDB session_id from the config.

Parameters

NameTypeDescription
configConfigManagerConfigManager instance.

Returns

  • Optional[str]TMDB session ID string or None if not found.
Source

get_tvdb_token

def get_tvdb_token(config: ConfigManager) -> Optional[str]:

Extract the TVDB token from the config.

Parameters

NameTypeDescription
configConfigManagerConfigManager instance.

Returns

  • Optional[str]TVDB token string or None if not found.
Source
Built with Kiln