Users Module#

class pypufferblow.users.Users(options: UsersOptions)[source]#

The underline class for managing the users routes.

user#

The user model.

Type:

UserModel

is_signed_in (bool, default

False): The user’s sign-in status.

is_owner (bool, default

False): The user’s owner status.

is_admin (bool, default

False): The user’s admin status

API_ROUTES#

The list of the API routes.

Type:

list[Route]

SIGNIN_API_ROUTE#

The sign-in API route.

Type:

Route

SIGNUP_API_ROUTE#

The sign-up API route.

Type:

Route

PROFILE_API_ROUTE#

The profile API route.

Type:

Route

RESET_AUTH_TOKEN_API_ROUTE#

The reset auth token API route.

Type:

Route

LIST_USERS_API_ROUTE#

The list users API route.

Type:

Route

get_user_profile(user_id: str | None = None) UserModel[source]#

Fetch the current user’s profile or an other user on the server.

Parameters:
  • (str (user_id) – None): The user’s user_id.

  • default – None): The user’s user_id.

Returns:

A UserModel containing the user’s profile.

Return type:

UserModel

Example

>>> user: UserModel = client.users.get_user_profile()
list_users() list[UserModel][source]#

List all the users.

Parameters:

None.

Returns:

A list of UserModel objects.

Return type:

list[UserModel]

reset_user_auth_token() None[source]#

Reset the user’s auth_token.

Returns:

None.

Example

>>> client.users.reset_user_auth_token()
sign_in() str[source]#

Sign in to the user account.

Returns:

None.

Example

>>> auth_token = client.users.sign_in()
sign_up() None[source]#

Sign up.

Returns:

None.

Example

>>> client.users.sign_up()
update_user_password(old_password: str, new_password: str) None[source]#

Update the user’s password.

Parameters:
  • old_password (str) – The old user’s password.

  • new_password (str) – The new user’s password.

Returns:

None.

Example

>>> client.users.update_user_password(
...    old_password="OLD_NOT_SECURE_PASSWORD",
...    new_password="NEW_SUPER_SECURE_PASSWORD"
... )
update_user_status(new_status: str) None[source]#

Update the user’s status.

Parameters:

new_status (str) – The new user’s status.

Returns:

None.

Example

>>> from pypufferblow.users import (
...    ONLINE_USER_STATUS,
...    OFFLINE_USER_STATUS,
...    INVISIBLE_USER_STATUS
... )
>>> client.users.update_user_status(
...    new_status=ONLINE_USER_STATUS
... )
update_username(new_username: str) None[source]#

Update the user’s username.

Parameters:

new_username (str) – The new user’s username.

Returns:

None.

Example

>>> client.users.update_username(new_username="new_username")
class pypufferblow.users.UsersOptions(host: str | None = '127.0.0.1', port: int | None = 7575, username: str | None = None, password: str | None = None)[source]#

UsersOptions class used for managing the Users object options.