Accounts Reference

The accounts interface provides a way to login, register and modify user specific data with the Kemono API.

Accounts

class pykemo.accounts.account.Account(*, id, username, created_at, role, session)

A Kemono account.

Warning

It is not recommended to use unless you know what you’re doing. Methods like login() are preferred as they automatically create a session internally.

Parameters:
  • id (int) – The account ID.

  • username (str) – The name of the user’s account.

  • created_at (datetime.datetime) – When was the account created.

  • role (AccountRole) – The special role/rank of the account.

  • session (KemoSession) – The underlying session of the account context.

async favorite_artists()

Tries to retrieve this account’s favorite artists. Alias for favorite_creators().

Returns:

The list of favorite artists (creators).

Return type:

list[Creator]

async favorite_creators()

Tries to retrieve this account’s favorite creators.

Returns:

The list of favorite creators.

Return type:

list[Creator]

async favorite_posts()

Tries to retrieve this account’s favorite posts.

Returns:

The list of favorite posts.

Return type:

list[Post]

async get_creator(service, creator_id)

A wrapper for fetching a creator with the account session.

Parameters:
  • service (ServiceLike) – The service of the creator.

  • creator_id (str) – The ID of the creator.

Returns:

The creator instance, if found. Otherwise returns None.

Return type:

Optional[Creator]

async classmethod login(user, password)

Tries to login with a given user and password.

Parameters:
  • user (str) – The username to try to login with.

  • password (str) – The password to try to login with.

Raises:
Returns:

The account of the user, if sucessfully logged in.

Return type:

Account

async logout()

Log out of the session.

Return type:

None