MythicAuth

class hostedpi.auth.MythicAuth(*, settings: Settings | None = None, auth_session: Session | None = None, api_session: Session | None = None)[source]

This class handles authentication with the Mythic Beasts Hosted Pi API.

It manages the access token used to authenticate requests to the API, and automatically refreshes it when it expires.

Parameters:
  • settings (Settings or None) – The settings used to configure the API. If not provided, defaults to a new instance of Settings.

  • auth_session (requests.Session or None) – The session used to make authentication requests. If not provided, defaults to a new requests.Session.

  • api_session (requests.Session or None) – The session used to make API requests. If not provided, defaults to a new requests.Session.

Warning

This is for advanced use only. Most users should not need to interact with the authentication system directly, as it is handled automatically by PiCloud.

Raises:

pydantic_core.ValidationError – If the provided settings are invalid or missing required fields.

property session: Session

The session used to make requests to the Hosted Pi API

property settings: Settings

The settings used to configure the API

property token: str

The access token used to authenticate requests to the API. The token is automatically refreshed when it expires.