scorebook.trismik_services.login
Authentication and token management for Trismik API.
get_scorebook_config_dir
def get_scorebook_config_dir() -> str
Get the scorebook config directory.
get_token_path
def get_token_path() -> str
Get the path where the trismik token is stored.
save_token
def save_token(token: str) -> None
Save the token to the local cache directory.
get_stored_token
def get_stored_token() -> Optional[str]
Retrieve the stored token from the cache directory.
get_token
def get_token() -> Optional[str]
Get the trismik API token in order of priority.
Priority order:
- TRISMIK_API_KEY environment variable
- Stored token file
validate_token
def validate_token(token: str) -> bool
Validate the token by making a test API call to trismik.
login
def login(trismik_api_key: str) -> None
Login to trismik by saving API key locally.
Arguments:
trismik_api_key
- The API key to use.
Raises:
ValueError
- If API key is empty or invalid.
logout
def logout() -> bool
Remove the stored token.
Returns:
bool
- True if a token was removed, False if no token was found.
whoami
def whoami() -> Optional[str]
Return information about the current user/token.
Returns:
str
- The stored token if logged in, None if not logged in.