pytenno.interface.auth

Module holding the Auth interface class.

class pytenno.interface.auth.Auth(backend: PyTennoBackend)[source]

Class for the authentication backend.

async login(*, email: str, password: str, device_id: Optional[str] = None) CurrentUser[source]

Logs in the user with the given credentials.

Parameters
  • email (str) – The email of the user.

  • password (str) – The password of the user.

  • device_id (str, optional) – The device ID of the user. This can be used to recognize the device between sessions. Default: None.

Return type

CurrentUser

Example

>>> async with PyTenno() as tenno:
>>>     current_user = await tenno.auth.login(
>>>         email="example@nothing.co"
>>>         password="password"
>>>     )
>>>     print(current_user.ingame_name)
async register(*, email: str, password: str, region: Optional[Literal['en', 'ru', 'ko', 'fr', 'sv', 'de', 'zh_hans', 'zh_hant', 'pt', 'es', 'pl']] = None, device_id: Optional[str] = None, recaptcha: Optional[str] = None) CurrentUser[source]

Registers a new user with the given credentials.

Parameters
  • email (str) – The email of the user.

  • password (str) – The password of the user.

  • region (Optional[VALID_LANGUAGES]) – The region of the user. Default: None, meaning the default set during client construction.

  • device_id (str) – The device ID of the user, used to identify devices between sessions. Default: None.

  • recaptcha (str) – The Google recaptcha response of the user. Default: None.

Return type

CurrentUser

Example

>>> async with PyTenno() as pytenno:
>>>     email = "example@nothing.co"
>>>     password = "password"
>>>     region = "en"
>>>     current_user = await pytenno.auth.register(email, password, region)
>>>     print(current_user.ingame_name)
async restore(email: str) None[source]

“Sends the user a recovery email.

Parameters

email (str) – The email of the user.

Example

>>> async with PyTenno() as pytenno:
>>>     email = "example@nothing.co"
>>>     await pytenno.auth.recover(email=email)