db_api_handler module

exception core.db_api_handler.APIError

Bases: Exception

Custom exception for local SRD API-related errors.

class core.db_api_handler.LocalAPIHandler(base_path: str = 'core/data_/rulebook_json')

Bases: object

Loads 5e SRD JSON files from disk and provides a local API-like interface.

Automatically maps file names like ‘5e-SRD-Classes.json’ to categories such as ‘classes’.

Parameters:

base_path (str) – Path to the directory containing 5e-SRD JSON files.

get(category: str, params: dict[str, Any] | None = None) → Any
get_monster(name: str) → dict[str, Any] | None
get_raw(endpoint: str, params: dict[str, Any] | None = None) → dict[str, Any] | None
get_spell(name: str) → dict[str, Any] | None
list_available(category: str) → Any
list_categories() → list[str]