pyarcher package

Module contents

Top-level package for RSA Archer Client Library.

class pyarcher.Archer(url: str, instance_name: str, user_domain: str = None, username: str = None, password: str = None, client_cert: tuple = None, session_token: str = None)[source]

Bases: pyarcher.base.ArcherBase

Creates archer instance object using following arguments

A username and password or a cert and key must be passed to initiate an archer instance.

Parameters:
  • url (str) – Full path url to archer instance. example: https://archer.com/rsarcher
  • instance_name (str) – Archer instance name.
  • user_domain (optional, str) –
  • username (optional, str) – Username to login with.
  • password (optional, str) – Password to login with.
  • client_cert (optional, tuple(str, str)) – Tuple of cert and key file path.

Attributes:

create_group(name: str, description: str = None, parent_groups: list = None, child_groups: list = None, child_users: list = None)[source]

Create a group.

Parameters:
  • name (str) – Name of the group.
  • description (str, optional) – Description of the group.
  • parent_groups (list[int], optional) – List of group ids to be set as
  • parent. (a) –
  • child_Groups (list[int], optional) – List of group ids to be set as
  • child. (a) –
  • child_users (list[int], optional) – List of user ids to be set as a
  • member.
Returns:

pyarcher.group.Group else:

resp (requests.models.Response)

Return type:

If successful

create_user(username: str, first_name: str, last_name: str, password: str, account_status: int = 1)[source]

Create User.

Create an archer user.

Parameters:
  • username (str) – Desired username
  • first_name (str) – User’s first name
  • last_name (str) – User’s last name
  • password (str) – User’s password
  • account_status (int) – Pass the integer value for active, inactive,
  • locked
Returns:

resp (requests.models.Response)

delete_group(group_id: int)[source]

Delete Group.

Parameters:group_id (int) – Group ID
Returns:resp (requests.models.Response)
delete_user(obj_id)[source]

Delete User.

get_active_users_with_no_login()[source]

Prebuilt function for query_user.

get_all_application()[source]
get_all_groups() → dict[source]

Get all archer groups.

Returns:groups (List[pyarcher.group.Group])
get_application(obj_id: int)[source]

Get an application.

Get an archer application object

Parameters:obj_id (int) – Application ID
Returns:pyarcher.application.Application
get_group(obj_id)[source]

Get a group.

Get a archer group object

Parameters:obj_id (int) – Group ID
Returns:pyarcher.group.Group
get_group_hierarchy()[source]

Get all group hierarchy.

get_groups_by_user(user_id: int)[source]

Get all groups that are assigned to a user.

Parameters:user_id (int) – User id to check groups
Returns:List[pyarcher.group.Groups]
get_user(obj_id: int)[source]

Get a user.

Get a archer user object

Parameters:obj_id (int) – User ID
Returns:pyarcher.user.User
group_membership

Group Membership property method.

Returns:List[Dict]
group_membership_setter(group_id: int)[source]

Group membership data form specific group.

Parameters:group_id (int) – Group ID
Returns:hold (dict)
modify_child_group(group_id: int, group_member_id: int, is_add: bool)[source]

Modify child group

Parameters:
  • group_id (int) – Group id to target
  • group_member_id (int) – Group id to add or remove from group member
  • is_add (bool) – Add or remove role from group
Returns:

pyarcher.group.Group else:

resp (requests.models.Response)

Return type:

If successful

modify_group_role(group_id: int, role_id: int, is_add: bool)[source]

Modify Group Role.

Parameters:
  • group_id (int) – Group id to target
  • role_id (int) – Role id to add or remove from group
  • is_add (bool) – Add or remove role from group
Returns:

pyarcher.group.Group else:

resp (requests.models.Response)

Return type:

If successful

query_groups(params: dict = {}, raw=False)[source]

Query for Groups.

Parameters:params (dict) – Send a dictionary of ODATA Params without the “$”. Example: params[‘filter’] = “Name eq ‘group_name’”
Returns:
The response of the http call from
requests.
Return type:requests.models.Response
query_users(params: dict = {}, raw=False)[source]

Query for Users.

Parameters:params (dict) – Send a dictionary of ODATA Params without the “$”. Example: params[‘filter’] = “AccountStatus eq ‘1’”
Returns:
The response of the http call from
requests.
Return type:requests.models.Response
raw_version()[source]

Return dictionary of the version.

refresh_metadata()[source]

Refresh Metadata.

update_group(group_id: int, name: str, parent_groups: list = None, child_groups: list = None, child_users: list = None)[source]

Update Group.

Update this groups child groups, members, name, description, or parent groups. This function is delcarative, meaning whatever you specify will be the truth. WARNING: This will not update other objects that are affected by this.

Parameters:
  • group_id (int) – Group ID to modify
  • name (str) – Group Name
  • parent_group (list[int]) – List of group ids to be set as a parent.
  • child_group (list[int]) – List of group ids to be set as a child.
  • child_users (list[int]) – List of user ids to be set as a member.
Returns:

resp (requests.models.Response)

update_user(obj_id)[source]

Update User.

version

Property method for version