animedex.config.profile
Programmatic configuration object for animedex callers.
Config is the typed, immutable equivalent of the CLI’s flag
stack. Every public API function in animedex accepts an
optional config keyword argument and falls back to module-level
defaults when not given. The CLI translates flags into a
Config instance one-to-one and hands it off; downstream
Python users construct a Config directly.
The fields here are deliberately a 1:1 mirror of the CLI flags
defined in plans/03 §9 so that “what does this command do” and
“what does this Python call do” stay in lock-step.
Config
- class animedex.config.profile.Config(*, rate: Literal['normal', 'slow'] = 'normal', cache_ttl_seconds: int | None = None, no_cache: bool = False, source_attribution: bool = True, user_agent: str | None = None, timeout_seconds: float = 30.0, token_store: TokenStore | None = None)[source]
Bases:
BaseModelFrozen configuration object.
- Variables:
rate (Literal["normal", "slow"]) – Voluntary rate-limit slowdown.
"slow"halves the default refill rate;"normal"is the upstream- sanctioned default. We do not expose a faster mode because that would violate P1 caps.cache_ttl_seconds (int or None) – Override for the per-row TTL applied to new cache entries.
Nonemeans each call uses the default for its category.no_cache (bool) – When
Truethe call bypasses the cache for both reads and writes.source_attribution (bool) – When
True(the default) the JSON renderer includes_sourceon every field. The TTY renderer always shows the source column.user_agent (str or None) – Override for the User-Agent string.
Nonemeans the project default (animedex.transport.useragent.default_user_agent()).timeout_seconds (float) – HTTP request timeout in seconds.
token_store (TokenStore or None) – Caller-supplied
TokenStore.Nonemeans resolve lazily to aKeyringTokenStoreon first use.
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- rate: _RateLiteral
- token_store: TokenStore | None
- effective_token_store() TokenStore[source]
Resolve
token_storeto a usableTokenStore.Returns the explicitly-supplied store when one was passed, otherwise constructs a fresh
KeyringTokenStore. The construction is deferred to call time so an environment without a real OS keyring backend does not break a code path that never actually needs credentials.- Returns:
A
TokenStoreready for use.- Return type: