wxc_sdk.tokens module

Simple implementation of Webex tokens

class wxc_sdk.tokens.Tokens(*, access_token: Optional[str] = None, expires_in: Optional[int] = None, expires_at: Optional[datetime] = None, refresh_token: Optional[str] = None, refresh_token_expires_in: Optional[int] = None, refresh_token_expires_at: Optional[datetime] = None, token_type: Optional[Literal['Bearer']] = None)[source]

Bases: BaseModel

Webex tokens

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

access_token: Optional[str]

access token

expires_in: Optional[int]

remaining lifetime at time of token creation

expires_at: Optional[datetime]

expiration, calculated at time of token creation

refresh_token: Optional[str]

refresh token

refresh_token_expires_in: Optional[int]
refresh_token_expires_at: Optional[datetime]

expiration, calculated at time of token creation

token_type: Optional[Literal['Bearer']]
update(new_tokes: Tokens)[source]

Update with values from new tokens

Parameters

new_tokes (Tokens) – tokens instance to be used as source

set_expiration()[source]

Set expiration based on current time and expires in values

property remaining: int

remaining lifetime in seconds