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:
BaseClientClient 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:
api_key (
Optional[str]) – Optional API key for authentication.token_manager (
Optional[VerkadaTokenManager]) – Optional token manager for handling tokens.
- 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:
- 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.
- 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.
- 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:
- Return type:
- 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:
- 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:
- 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:
- 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.