Users

Retrieving user objects

class UserMixin

This class defines all functions related to BlueConic users.

get_user(user_id)

Gets the user with the user ID and returns it as a BlueConic role.

Raises:

HTTPError: Request fails

Returns:

User

Return type:

User

Usage:
>>> import blueconic
>>> bc = blueconic.Client()
>>> user = bc.get_user("john@example.com")
>>> print(user.id)
"john@example.com"
get_users(start=0, count=10000000)

Gets all users and returns them in a generator with all BlueConic users.

Parameters:
  • start (int, optional) – The user to start from. Defaults to 0.

  • count (int, optional) – The number of users to retrieve. Defaults to 10000000.

Returns:

Iterator with User

Return type:

Iterator[User]

Usage:
>>> import blueconic
>>> bc = blueconic.Client()
>>> for user in bc.get_users():
>>>  print(user.id)
"john@example.com"
"anna@example.com"

Using user objects

class User
__init__(user_id, name, description, creator_username, creation_date, last_modified_username, last_modified_date, labels, last_login_date, roles, permissions, has_all_domains, domains)

This class represents a BlueConic user.

Parameters:
  • user_id (str) – The ID of the user

  • name (str) – The name of the user

  • description (Optional[str]) – The description of the user

  • creator_username (Optional[str]) – The username that created the user

  • creation_date (Optional[datetime]) – The creation date of the user

  • last_modified_username (Optional[str]) – The username that last modified the user

  • last_modified_date (Optional[datetime]) – The last modified date of the user

  • labels (Optional[Sequence[str]]) – The labels of the user

  • last_login_date (Optional[datetime]) – The last date time the user logged in

  • roles (Optional[Sequence[str]]) – The list of roles the user has

  • permissions (Optional[Sequence[str]]) – The list of permissions the user has

  • has_all_domains (bool) – Whether the user has access to all domains.

  • domains (Optional[Sequence[Domain]]) – If hasAllDomains is false, returns the domains the user has access to

property creation_date
Returns:

The creation date of this object.

Return type:

Optional[datetime]

property creator_username
Returns:

The username that created this object.

Return type:

Optional[str]

property description
Returns:

Description of this object.

Return type:

Optional[str]

property domains
Returns:

If hasAllDomains is false, returns the domains the user has access to.

Return type:

Optional[Sequence[Domain]]

property has_all_domains
Returns:

Whether the user has access to all domains.

Return type:

bool

property id
Returns:

ID of this object.

Return type:

str

property labels
Returns:

The labels this object.

Return type:

Optional[Sequence[str]

property last_login_date
Returns:

Returns the last login date for this user.

Return type:

Optional[datetime]

property last_modified_date
Returns:

The last modified date of this object.

Return type:

Optional[datetime]

property last_modified_username
Returns:

The last modified username of this object.

Return type:

Optional[str]

property name
Returns:

Name of this object.

Return type:

Optional[str]

property permissions
Returns:

Returns the permissions of this user.

Return type:

Sequence[str]

property roles
Returns:

Returns the roles of this user.

Return type:

Sequence[str]