Util

bosdyn.client.util.cli_login_prompt(username=None, password=None)[source]

Interactive CLI for scripting conveniences.

bosdyn.client.util.cli_auth(robot, username=None, password=None)[source]

Interactive CLI for authenticating with the robot.

class bosdyn.client.util.DedupLoggingMessages(always_print_logger_levels={40, 50})[source]

Bases: logging.Filter

Logger filter to prevent duplicated messages from being logged.

Parameters

always_print_logger_levels (set[logging.Level]) – A set of logging levels which any logged message at that level will always be logged.

filter(record)[source]

Determine if the specified record is to be logged.

Is the specified record to be logged? Returns 0 for no, nonzero for yes. If deemed appropriate, the record may be modified in-place.

bosdyn.client.util.setup_logging(verbose=False, include_dedup_filter=False, always_print_logger_levels={40, 50})[source]

Setup a basic streaming console handler at the root logger.

Parameters
  • verbose (boolean) – if False (default) show messages at INFO level and above, if True show messages at DEBUG level and above.

  • include_dedup_filter (boolean) – If true, the logger includes a filter which will prevent repeated duplicated messages from being logged.

  • always_print_logger_levels (set[logging.Level]) – A set of logging levels which any logged message at that level will always be logged.

bosdyn.client.util.does_dedup_filter_exist(logger, always_print_logger_levels)[source]

Check if the DedupLoggingMessages filter exists for a logger.

Returns

Boolean indicating if the DedupLoggingMessages filter already exists and matches the new parameters.

bosdyn.client.util.get_logger()[source]
bosdyn.client.util.default_app_token_path()[source]

Do nothing, this method is kept only to maintain backwards compatibility.

Deprecated since version 2.0.1: App tokens are no longer in use. Authorization is now handled via licenses.

bosdyn.client.util.add_base_arguments(parser)[source]

Add hostname argument to parser.

Parameters

parser – Argument parser object.

bosdyn.client.util.add_common_arguments(parser)[source]

Add arguments common to most applications used for authentication.

Parameters

parser – Argument parser object.

bosdyn.client.util.add_payload_credentials_arguments(parser, required=True)[source]

Add arguments common to most payload related applications.

Parameters
  • parser – Argument parser object.

  • required – Require all arguments to be populated.

bosdyn.client.util.add_service_hosting_arguments(parser)[source]

Add arguments common to most applications hosting a GRPC service.

Parameters

parser – Argument parser object.

bosdyn.client.util.add_service_endpoint_arguments(parser)[source]

Add arguments common to most applications defining a GRPC service endpoint.

Parameters

parser – Argument parser object.

class bosdyn.client.util.GrpcServiceRunner(service_servicer, add_servicer_to_server_fn, port=0, max_workers=4, max_send_message_length=None, max_receive_message_length=None, timeout_secs=3, force_sigint_capture=True, logger=None)[source]

Bases: object

A runner to start a gRPC server on a background thread and allow easy cleanup.

Parameters
  • service_servicer (custom servicer class derived from ServiceServicer) – Servicer that defines server behavior.

  • add_servicer_to_server_fn (function) – Function generated by gRPC compilation that attaches the servicer to the gRPC server.

  • port (int) – The port number the service can be accessed through on the host system. Defaults to 0, which will assign an ephemeral port.

  • max_send_message_length (int) – Max message length (bytes) allowed for messages sent.

  • max_receive_message_length (int) – Max message length (bytes) allowed for messages received.

  • timeout_secs (int) – Number of seconds to wait for a clean server shutdown.

  • force_sigint_capture (bool) – Re-assign the SIGINT handler to default in order to prevent other scripts from blocking a clean exit. Defaults to True.

  • logger (logging.Logger) – Logger to log with.

stop()[source]
run_until_interrupt()[source]

Spin the thread until a SIGINT is received and then shut down cleanly.

bosdyn.client.util.populate_response_header(response, request, error_code=1, error_msg=None)[source]

Sets the ResponseHeader header in the response. :param response: The GRPC response message to be populated. :type response: bosdyn.api Response message :param request: The header from the request is added to the response. :type request: bosdyn.api Request message :param error_code: The status for the RPC response. :type error_code: header_pb2.CommonError :param error_msg: An optional error message describing a bad header status failure. :type error_msg: str

Returns

Mutates the response message’s header to be fully populated.

bosdyn.client.util.strip_large_bytes_fields(proto_message)[source]
bosdyn.client.util.get_bytes_field_whitelist()[source]
bosdyn.client.util.strip_image_response(proto_message)[source]
bosdyn.client.util.strip_get_image_response(proto_message)[source]
bosdyn.client.util.strip_local_grid_responses(proto_message)[source]
bosdyn.client.util.strip_store_image_request(proto_message)[source]
bosdyn.client.util.strip_store_data_request(proto_message)[source]
bosdyn.client.util.strip_record_signal_tick(proto_message)[source]
bosdyn.client.util.strip_record_data_blob(proto_message)[source]
bosdyn.client.util.strip_log_annotation(proto_message)[source]