Configuration¶
Settings are loaded from environment variables (LPTK_ prefix) and credentials from a JSON keys
file (.tokens/local_keys.json by default).
- class lptk.Settings¶
Bases:
BaseSettingsApplication settings loaded from environment variables.
All settings can be overridden via environment variables with the LPTK_ prefix. For example, LPTK_LOG_LEVEL=DEBUG will set log_level to “DEBUG”.
- local_keys_path¶
Path to the JSON file holding local API keys.
- data_dir¶
Directory for storing JSON output files.
- log_level¶
Logging verbosity level.
- startgg_api_url¶
start.gg GraphQL API endpoint.
- rate_limit_delay¶
Delay between API calls in seconds.
- user_agent¶
Optional User-Agent header for API requests.
- model_config = {'arbitrary_types_allowed': True, 'case_sensitive': False, 'cli_avoid_json': False, 'cli_enforce_required': False, 'cli_exit_on_error': True, 'cli_flag_prefix_char': '-', 'cli_hide_none_type': False, 'cli_ignore_unknown_args': False, 'cli_implicit_flags': False, 'cli_kebab_case': False, 'cli_parse_args': None, 'cli_parse_none_str': None, 'cli_prefix': '', 'cli_prog_name': None, 'cli_shortcuts': None, 'cli_use_class_docs_for_groups': False, 'enable_decoding': True, 'env_file': '.env', 'env_file_encoding': 'utf-8', 'env_ignore_empty': False, 'env_nested_delimiter': None, 'env_nested_max_split': None, 'env_parse_enums': None, 'env_parse_none_str': None, 'env_prefix': 'LPTK_', 'env_prefix_target': 'variable', 'extra': 'ignore', 'json_file': None, 'json_file_encoding': None, 'nested_model_default_partial_update': False, 'protected_namespaces': ('model_validate', 'model_dump', 'settings_customise_sources'), 'secrets_dir': None, 'toml_file': None, 'validate_default': True, 'yaml_config_section': None, 'yaml_file': None, 'yaml_file_encoding': None}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- lptk.get_settings()¶
Get the application settings singleton.
Settings are cached after the first call. To reload settings, call get_settings.cache_clear() first.
- Return type:
- Returns:
The Settings instance.
- lptk.get_token()¶
Get the start.gg API token.
Reads
local_keys.jsonon first call and returns thestartggfield.- Return type:
- Returns:
The start.gg API token string.
- Raises:
ConfigurationError – If the keys file is missing, malformed, or the
startggfield is missing or empty.
- lptk.get_lpdb_token()¶
Get the Liquipedia DB API key.
Reads
local_keys.jsonon first call and returns thelpdbfield.- Return type:
- Returns:
The Liquipedia DB API key.
- Raises:
ConfigurationError – If the keys file is missing or malformed, or the
lpdbfield is absent / empty.