iqm.iqm_client.authentication.TokenManager#
- class iqm.iqm_client.authentication.TokenManager(token: str | None = None, tokens_file: str | None = None)#
- Bases: - object- TokenManager manages the access token required for user authentication. - Parameters:
 - The parameters can also be read from the environment variables IQM_TOKEN or IQM_TOKENS_FILE. Environment variables can not be mixed with initialisation arguments. All parameters must come from the same source. - Methods - close()- Close the configured token provider. - get_bearer_token([retries])- Returns a valid bearer token, or None if no user authentication has been configured. - time_left_seconds(token)- Check how much time is left until the token expires. - get_bearer_token(retries: int = 1) str | None#
- Returns a valid bearer token, or None if no user authentication has been configured. - Raises:
- ClientAuthenticationError – getting the token failed 
- Parameters:
- retries (int) 
- Return type:
- str | None 
 
 - close() bool#
- Close the configured token provider. - Returns:
- True if closing was successful 
- Raises:
- ClientAuthenticationError – closing failed 
- Return type:
 
 
