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.

bosdyn.client.util.setup_logging(verbose=False)[source]

Setup a basic streaming console handler at the root logger.

Parameters

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

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

Deprecated method to get app token, no longer necessary.

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.

  • timout_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_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]