Utils

Utility functions for Scout web API

bosdyn.scout.utils.get_credentials()[source]

Obtains credentials from either environment variables or terminal inputs - Returns

  • username(str): the username for the Scout instance

  • password(str): the password for the Scout instance

bosdyn.scout.utils.get_latest_created_at_for_run_events(scout_client, params={})[source]

Given a dictionary of query params, returns the max created at time for run events - Args:

  • scout_client(ScoutClient object): the client for Scout web API

  • params(dict): the query params associated with the get request

  • Raises:
    • RequestExceptions: exceptions thrown by the Requests library

    • UnauthenticatedScoutClientError: indicates that the scout client is not authenticated properly

  • Returns:
    • datetime.datetime(datetime representation): the max created at time for run events in datetime

bosdyn.scout.utils.get_latest_run_capture_resources(scout_client, params={})[source]

Given a dictionary of query params, returns the latest run capture resources in json format - Args:

  • scout_client(ScoutClient object): the client for Scout web API

  • params(dict): the query params associated with the get request

  • Raises:
    • RequestExceptions: exceptions thrown by the Requests library

    • UnauthenticatedScoutClientError: indicates that the scout client is not authenticated properly

  • Returns:
    • Run Capture Resources(list): a list of resources obtained from Scout’s RESTful endpoint

bosdyn.scout.utils.get_latest_created_at_for_run_captures(scout_client, params={})[source]

Given a dictionary of query params, returns the max created at time for run captures - Args:

  • scout_client(ScoutClient object): the client for Scout web API

  • params(dict): the query params associated with the get request

  • Raises:
    • RequestExceptions: exceptions thrown by the Requests library

    • UnauthenticatedScoutClientError: indicates that the scout client is not authenticated properly

  • Returns:
    • datetime.datetime(datetime representation): the max created at time for run captures in datetime

bosdyn.scout.utils.get_latest_run_resource(scout_client, params={})[source]

Given a dictionary of query params, returns the latest run resource in json format - Args:

  • scout_client(ScoutClient object): the client for Scout web API

  • params(dict): the query params associated with the get request

  • Raises:
    • RequestExceptions: exceptions thrown by the Requests library

    • UnauthenticatedScoutClientError: indicates that the scout client is not authenticated properly

  • Returns:
    • Run Resource(json): a resource obtained from Scout’s RESTful endpoint in json

bosdyn.scout.utils.get_latest_run_in_progress(scout_client, params={})[source]

Given a dictionary of query params, returns the latest running resource in json format - Args:

  • scout_client(ScoutClient object): the client for Scout web API

  • params(dict): the query params associated with the get request

  • Raises:
    • RequestExceptions: exceptions thrown by the Requests library

    • UnauthenticatedScoutClientError: indicates that the scout client is not authenticated properly

  • Returns:
    • Run(json): a run obtained from Scout’s RESTful endpoint in json

bosdyn.scout.utils.get_latest_end_time_for_runs(scout_client, params={})[source]

Given a dictionary of query params, returns the max end time for runs - Args:

  • scout_client(ScoutClient object): the client for Scout web API

  • params(dict): the query params associated with the get request

  • Raises:
    • RequestExceptions: exceptions thrown by the Requests library

    • UnauthenticatedScoutClientError: indicates that the scout client is not authenticated properly

  • Returns:
    • datetime.datetime(datetime representation): the max end for runs in datetime

bosdyn.scout.utils.write_image(img_raw, image_fp)[source]

Given a raw image and a desired output directory, writes the image to a file - Args:

  • img_raw(Raw image object): the input raw image

  • image_fp(str): the output filepath for the image

bosdyn.scout.utils.data_capture_urls_from_run_events(scout_client, run_events, list_of_channel_names=None)[source]

Given run events and list of desired channel names, returns the a list data capture urls - Args:

  • run_events(json): a json representation of run events obtained from Scout’s RESTful endpoint

  • list_of_channel_names(list): a list of channel names associated with the desired data captures.

    Defaults to None which returns all the available channels.

  • Returns:
    • data_urls(list): a list of urls

bosdyn.scout.utils.data_capture_url_from_run_capture_resources(scout_client, run_capture_resources, list_of_channel_names=None)[source]

Given run capture resources and list of desired channel names, returns the a list data capture urls - Args:

  • run_capture_resources(list): a list of resources obtained from Scout’s RESTful endpoint

  • list_of_channel_names(list): a list of channel names associated with the desired data captures.

    Defaults to None which returns all the available channels.

  • Returns:
    • data_urls(list): a list of urls

bosdyn.scout.utils.get_action_names_from_run_events(run_events)[source]

Given run events, returns a list of action names - Args:

  • run_events(json): a json representation of run events obtained from Scout’s RESTful endpoint

  • Returns:
    • action_names(list): a list of action names

bosdyn.scout.utils.datetime_from_isostring(datetime_isostring)[source]

Returns the datetime representation of the iso string representation of time - Args:

  • datetime_isostring(str): the iso string representation of time

  • Returns:
    • datetime.datetime(datetime representation): the datetime representation of the iso string representation of time