Skip to content

User

Representing a Datatailr User.

This class provides methods to interact with the Datatailr User API. It allows you to create, update, delete, and manage users within the Datatailr platform.

Attributes:

  • first_name (str) –

    The first name of the user.

  • last_name (str) –

    The last name of the user.

  • name (str) –

    The username of the user.

  • email (str) –

    The email address of the user.

  • user_id (int) –

    The unique identifier for the user.

  • groups (list) –

    List of groups the user belongs to.

  • is_system_user (bool) –

    Indicates if the user is a system user.

At least one of name or id must be provided. When both are given, name takes precedence.

Parameters:

  • name

    (str | None, default: None ) –

    The username to look up.

  • id

    (int | None, default: None ) –

    The numeric user ID to look up.

  • first_name

    (str | None, default: None ) –

    The first name of the user.

  • last_name

    (str | None, default: None ) –

    The last name of the user.

  • email

    (str | None, default: None ) –

    The email address of the user.

  • groups

    (list[str] | None, default: None ) –

    The list of groups the user belongs to.

  • is_system_user

    (bool, default: False ) –

    Whether the user is a system user.

Raises:

  • ValueError

    If neither name nor id is provided.

email property

The email address of the user.

first_name property

The first name of the user.

groups property

List of group names the user belongs to.

is_system_user property

Whether this user is a system (non-interactive) user.

last_name property

The last name of the user.

name property

The username.

user_id property

The unique numeric identifier of the user.

add staticmethod

Create a new user on the Datatailr platform.

Parameters:

  • name

    (str) –

    The username for the new user.

  • first_name

    (str) –

    The user's first name.

  • last_name

    (str) –

    The user's last name.

  • email

    (str) –

    The user's email address.

  • password

    (str) –

    The login password. Ignored for system users.

  • groups

    (list[str] | None, default: None ) –

    Optional list of group names to add the user to.

  • is_system_user

    (bool, default: False ) –

    If True, create a non-interactive system user.

Returns:

  • 'User' | None

    The newly created User, or None if the operation failed.

Raises:

  • Warning

    If a password is provided for a system user.

Notes

Passwords are ignored for system users.

exists staticmethod

Check whether a user with the given username exists.

Parameters:

  • name

    (str) –

    The username to look up.

Returns:

  • bool

    True if the user exists, False otherwise.

from_dict classmethod

Construct a User instance from a dictionary.

get staticmethod

Retrieve an existing user by username or numeric ID.

Parameters:

  • name_or_id

    (str | int) –

    The username (str) or user ID (int).

Returns:

  • User

    The matching User instance.

Raises:

  • ValueError

    If no user with the given name or ID exists.

ls staticmethod

List all users available in the Datatailr platform.

Parameters:

  • filter

    (str | None, default: None ) –

    A filter expression to apply to the users.

Examples:

>>> from datatailr import User
>>> User.ls()
[...User(name=root, first_name=Super User, last_name=, email=, user_id=0, groups=[''], is_system_user=True), ...]

Returns:

  • list

    A list of User instances.

remove staticmethod

Remove (delete) a user from the platform.

Parameters:

  • name

    (str) –

    The username of the user to remove.

signed_user staticmethod

Retrieve the currently signed-in (authenticated) user.

Returns:

  • User

    The User instance of the currently authenticated user.

Raises:

  • PermissionError

    If no signed-in user is found.

Return a cookie string for the user.

verify

Verify the user's authentication signature with the platform.

This refreshes and validates the user's credentials against the Datatailr authentication service.