Access Controlled Door Util

bosdyn.client.access_controlled_door_util.file_to_json(file_path)[source]

Helper to read and parse JSON files. :param file_path: Path to JSON file. :type file_path: Path

Returns:

Parsed JSON data.

Return type:

dict

bosdyn.client.access_controlled_door_util.door_action(api_calls, door_id, action, path_to_cert=None, is_robot=True)[source]

Executes a sequence of API calls required to perform an action (e.g., open or close) on a specified door, handling data substitutions and certificate verification as needed.

api_calls (list of dict): List of API call specifications, where each dict contains information

such as ‘method’, ‘url’, ‘action’, ‘sni_hostname’, ‘route’, ‘request_data’, and ‘responses’.

door_id (str): Identifier of the door to perform the action on. action (list of str): The action(s) to perform (e.g., “open”, “close”). Only calls matching

the specified action(s) will be executed.

path_to_cert (str, optional): Path to a certificate file for SSL verification. If None, no certificate

is used.

is_robot (bool, optional): Indicates if the API calls are being made on behalf of a robot. Defaults to True.

Returns:

An error message dictionary containing details about any error encountered during the API calls.

If all calls succeed, returns an empty dictionary.

Return type:

dict

bosdyn.client.access_controlled_door_util.make_access_control_system_api_call(method, url, request_data, store_responses=None, sni_hostname=None, is_robot=True, route=None)[source]

Makes an HTTP request and optionally extracts specific fields from the JSON response.

Parameters:
  • method (str) – HTTP method to use (e.g., ‘GET’, ‘POST’)

  • url (str) – The endpoint URL for the API call

  • request_data (dict) – Request configuration including headers, body, etc.

  • store_responses (Optional[Dict[str, str]]) –

    Dictionary mapping response field names to JSON paths. For example: {

    ”token”: “auth.token”, # Store response’s auth.token as “token” “session_id”: “data.session” # Store response’s data.session as “session_id”

    } If None, no data will be extracted from the response.

  • sni_hostname (str|None) – If specified, this parameter provides the hostname declared by and expected by the access control server during TLS negotiation. This should only be required if the server’s hostname is not resolvable via DNS.

  • route (str|None) – Route type to use (“WIFI”, “LTE”). If None, default interface (WIFI) will be used.

Returns:

  • First element: If store_responses was provided and matching data was found, returns list of tuples [(field_name, value), …]. None otherwise.

  • Second element: If error occurred, returns dict with error details: {

    ’status_code’: int, ‘reason’: str, ‘elapsed’: float

    } None if successful.

Return type:

Tuple[Optional[List[Tuple[str, Any]]], Optional[Dict]]

Example

>>> store_responses = {"auth_token": "data.token"}
>>> data, error = make_access_control_system_api_call("POST", "https://api.door/auth",
...                                                   {"json": {"key": "value"}},
...                                                   store_responses)
>>> if data:
...     # data might be [("auth_token", "abc123")]
...     token = dict(data)["auth_token"]
bosdyn.client.access_controlled_door_util.get_value_by_path(data_json, path_to_info)[source]

Takes in a json representing the data of a call response, and a string representing the path through the json to the desired data. Traverses the json and returns the data.