User

class perses_api.user.User[source]

Bases: object

The class includes all necessary methods to access the Perses users API

Parameters:

perses_api_model (APIModel) – Inject a Perses API model object that includes all necessary values and information

api

This is where we store the api

Type:

Api

__init__(perses_api_model: APIModel)[source]
create_user(user: User) dict[source]

The method includes a functionality to create a new user

Parameters:

user (User) – Specify the user resource to create

Raises:

Exception – Unspecified error by executing the API call

Returns:

The created user dict

Return type:

dict

delete_user(name: str) None[source]

The method includes a functionality to delete a user by name

Parameters:

name (str) – Specify the name of the user to delete

Raises:

ValueError – Missed specifying a necessary value

get_user(name: str) dict[source]

The method includes a functionality to retrieve a single user by name

Parameters:

name (str) – Specify the name of the user to retrieve

Raises:
  • ValueError – Missed specifying a necessary value

  • Exception – Unspecified error by executing the API call

Returns:

The user dict

Return type:

dict

get_users(name: str = None) list[source]

The method includes a functionality to retrieve all users

Parameters:

name (str) – Specify a name to filter the results (default None)

Raises:

Exception – Unspecified error by executing the API call

Returns:

A list of user dicts

Return type:

list

update_user(name: str, user: User) dict[source]

The method includes a functionality to update an existing user by name

Parameters:
  • name (str) – Specify the name of the user to update

  • user (User) – Specify the updated user resource

Raises:
  • ValueError – Missed specifying a necessary value

  • Exception – Unspecified error by executing the API call

Returns:

The updated user dict

Return type:

dict