Skip to content

Authnetication

MqAuth dataclass

MqAuth(
    client_id: str,
    client_secret: str,
    client: Client = (lambda: Client())(),
    env: MqApiEnvironment = PROD,
    expires_at: datetime = (lambda: now())(),
)

Methods:

  • refresh

    Refresh the acccess token

Attributes:

client class-attribute instance-attribute

client: Client = field(
    default_factory=lambda: Client(), repr=False
)

client_id instance-attribute

client_id: str

client_secret class-attribute instance-attribute

client_secret: str = field(repr=False)

env class-attribute instance-attribute

env_str property

env_str: str

expires_at class-attribute instance-attribute

expires_at: datetime = field(default_factory=lambda: now())

oauth_host property

oauth_host: str

token property

token: str

Returns the token. If expired, will automatically renew.

Raises:

  • AuthenticationException

    if the authentication fails

Returns:

  • str ( str ) –

    the Bearer token, without Bearer prefix

token_url property

token_url: str

refresh

refresh() -> None

Refresh the acccess token

MqApiEnvironment

Bases: str, Enum

Attributes:

DEV class-attribute instance-attribute

DEV = 'dev'

PREVIEW class-attribute instance-attribute

PREVIEW = 'preview'

PROD class-attribute instance-attribute

PROD = 'prod'

See also: Data models for base types.