Token Manager¶
Token management for pykada.
VerkadaTokenManager fetches and caches a short-lived Verkada API
token, automatically refreshing it before expiry (25-minute buffer on a
30-minute token lifetime).
Module-level helpers get_default_token_manager() and
get_default_api_token() provide a shared manager bootstrapped from the
VERKADA_API_KEY environment variable (or a .env file).
- class pykada.api_tokens.VerkadaTokenManager(api_key, token_url='https://api.verkada.com/token', response_json_key='token', token_lifetime_minutes=30)[source]¶
Bases:
objectManages a specific type of Verkada API token, caching it and refreshing it only when needed.
Initializes the token manager for a specific token type.
- Parameters:
api_key (
str) – Your Verkada API key.token_url (
str) – The URL endpoint to fetch this specific token (e.g., “https://api.verkada.com/token”).response_json_key (
str) – The key in the JSON response that holds the token value (e.g., “token” or “jwt”).token_lifetime_minutes (
int) – The expected lifetime of the token in minutes. Defaults to 30.