Workplace (Guest & Mailroom)

Workplace (Guest & Mailroom) API client and functional wrappers for pykada.

The WorkplaceClient provides access to guest visit history, site management, and deny-list uploads through Verkada’s Workplace API.

Client

class pykada.workplace.WorkplaceClient(api_key=None, token_manager=None)[source]

Bases: BaseClient

Client for interacting with Verkada’s Workplace (Guest & Mailroom) API. This client provides methods to manage guest visits, deny lists, and sites.

Initialize the client with either an API key or a token manager. If not key is provided, a default token manager will be used based on the environment configuration (VERKADA_API_KEY in a .env file).

Parameters:
get_guest_sites()[source]

Returns a list of Guest sites in an organization.

Return type:

Dict[str, Any]

Returns:

A dictionary containing guest site objects within the organization.

delete_guest_deny_list(site_id)[source]

Delete the deny list for a specific Guest site.

Parameters:

site_id (str) – The unique identifier for the Guest site.

Return type:

Dict[str, Any]

Returns:

JSON response confirming deletion.

Raises:

ValueError – If site_id is an empty string.

create_guest_deny_list(filename, site_id)[source]

Create a Deny List for a Verkada Guest site.

This function reads a CSV file from the given filename, encodes its contents into a Base64 ASCII string, and posts the data to the Guest Deny List endpoint. This operation will overwrite any Deny List in use for the site.

Query Parameters:
  • site_id (str): The unique identifier of the Guest site.

Body Parameters:
  • base64_ascii_deny_list_csv (str): Base64 encoded (ASCII) deny list CSV data.

Parameters:
  • filename (str) – Path to the CSV file containing the deny list.

  • site_id (str) – The unique identifier for the Guest site.

Return type:

Dict[str, Any]

Returns:

JSON response from the POST request.

Raises:

ValueError – If either filename or site_id is an empty string.

get_all_guest_visits(site_id, start_time, end_time)[source]

Retrieve all visits in a Guest site.

This function retrieves all visits within a specified time range for a given Guest site. It handles pagination automatically.

Parameters:
  • site_id (str) – Unique identifier for the Guest site.

  • start_time (int) – Start time as a UNIX timestamp.

  • end_time (int) – End time as a UNIX timestamp.

Return type:

Generator[Any, None, None]

Returns:

JSON response containing all guest visits.

get_guest_visits(site_id, start_time, end_time, page_token=None, page_size=100)[source]

Retrieve a list of visits in a Guest site.

Query Parameters:
  • site_id (str, required): The unique identifier of the Guest site.

  • start_time (int, required): The start of the time range for requested visits (UNIX timestamp).

  • end_time (int, required): The end of the time range for requested visits (UNIX timestamp).

    Must be at most one day (86400 seconds) away from start_time.

  • page_token (str, optional): The pagination token used to fetch the next page of results.

  • page_size (int, optional): The number of items returned in a single response (0 to 200). Defaults to 100.

Parameters:
  • site_id (str) – Unique identifier for the Guest site.

  • start_time (int) – Start time as a UNIX timestamp.

  • end_time (int) – End time as a UNIX timestamp.

  • page_token (Optional[str]) – Optional pagination token.

  • page_size (Optional[int]) – Optional number of items per response.

Return type:

Dict[str, Any]

Returns:

JSON response containing guest visits.

Raises:

ValueError – If site_id is empty, if the time range exceeds one day, or if page_size is out of range.

property request_manager: VerkadaRequestManager

Returns the request manager used by this client.

Functional wrappers

Workplace (Guest & Mailroom) API client and functional wrappers for pykada.

The WorkplaceClient provides access to guest visit history, site management, and deny-list uploads through Verkada’s Workplace API.

pykada.workplace.create_guest_deny_list(filename, site_id)[source]

Create a Deny List for a Verkada Guest site.

This function reads a CSV file from the given filename, encodes its contents into a Base64 ASCII string, and posts the data to the Guest Deny List endpoint. This operation will overwrite any Deny List in use for the site.

Query Parameters:
  • site_id (str): The unique identifier of the Guest site.

Body Parameters:
  • base64_ascii_deny_list_csv (str): Base64 encoded (ASCII) deny list CSV data.

Parameters:
  • filename (str) – Path to the CSV file containing the deny list.

  • site_id (str) – The unique identifier for the Guest site.

Returns:

JSON response from the POST request.

Raises:

ValueError – If either filename or site_id is an empty string.

Note: This is a functional wrapper for its equivalent method in the WorkplaceClient. It creates a new client instance on every call, making it best for single, convenient operations. For making multiple API calls, instantiate and use a WorkplaceClient object directly for better performance.

pykada.workplace.delete_guest_deny_list(site_id)[source]

Delete the deny list for a specific Guest site.

Parameters:

site_id (str) – The unique identifier for the Guest site.

Returns:

JSON response confirming deletion.

Raises:

ValueError – If site_id is an empty string.

Note: This is a functional wrapper for its equivalent method in the WorkplaceClient. It creates a new client instance on every call, making it best for single, convenient operations. For making multiple API calls, instantiate and use a WorkplaceClient object directly for better performance.

pykada.workplace.get_all_guest_visits(site_id, start_time, end_time)[source]

Retrieve all visits in a Guest site.

This function retrieves all visits within a specified time range for a given Guest site. It handles pagination automatically.

Parameters:
  • site_id (str) – Unique identifier for the Guest site.

  • start_time (int) – Start time as a UNIX timestamp.

  • end_time (int) – End time as a UNIX timestamp.

Returns:

JSON response containing all guest visits.

Note: This is a functional wrapper for its equivalent method in the WorkplaceClient. It creates a new client instance on every call, making it best for single, convenient operations. For making multiple API calls, instantiate and use a WorkplaceClient object directly for better performance.

pykada.workplace.get_guest_sites()[source]

Returns a list of Guest sites in an organization.

Returns:

A dictionary containing guest site objects within the organization.

Note: This is a functional wrapper for its equivalent method in the WorkplaceClient. It creates a new client instance on every call, making it best for single, convenient operations. For making multiple API calls, instantiate and use a WorkplaceClient object directly for better performance.

pykada.workplace.get_guest_visits(site_id, start_time, end_time, page_token=None, page_size=100)[source]

Retrieve a list of visits in a Guest site.

Query Parameters:
  • site_id (str, required): The unique identifier of the Guest site.

  • start_time (int, required): The start of the time range for requested visits (UNIX timestamp).

  • end_time (int, required): The end of the time range for requested visits (UNIX timestamp).

    Must be at most one day (86400 seconds) away from start_time.

  • page_token (str, optional): The pagination token used to fetch the next page of results.

  • page_size (int, optional): The number of items returned in a single response (0 to 200). Defaults to 100.

Parameters:
  • site_id (str) – Unique identifier for the Guest site.

  • start_time (int) – Start time as a UNIX timestamp.

  • end_time (int) – End time as a UNIX timestamp.

  • page_token (Optional[str]) – Optional pagination token.

  • page_size (Optional[int]) – Optional number of items per response.

Returns:

JSON response containing guest visits.

Raises:

ValueError – If site_id is empty, if the time range exceeds one day, or if page_size is out of range.

Note: This is a functional wrapper for its equivalent method in the WorkplaceClient. It creates a new client instance on every call, making it best for single, convenient operations. For making multiple API calls, instantiate and use a WorkplaceClient object directly for better performance.