Channel

class bosdyn.client.channel.RefreshingAccessTokenAuthMetadataPlugin(token_cb, add_app_token)[source]

Bases: grpc.AuthMetadataPlugin

Plugin to refresh access token.

Parameters
  • token_cb – Callable that returns a tuple of (app_token, user_token)

  • add_app_token (bool) – Whether to include an app token in the metadata. This is necessary for compatibility with old robot software.

bosdyn.client.channel.create_secure_channel_creds(cert, token_cb, add_app_token)[source]

Returns credentials for establishing a secure channel. Uses previously set values on the linked Sdk and self.

bosdyn.client.channel.create_secure_channel(address, port, creds, authority, options=[])[source]

Create a secure channel to given host:port.

Parameters
  • address – Connection host address.

  • port – Connection port.

  • creds – A ChannelCredentials instance.

  • authority – Authority option for the channel.

  • options – A list of additional parameters for the GRPC channel.

Returns

A secure channel.

bosdyn.client.channel.create_insecure_channel(address, port, authority=None, options=[])[source]

Create an insecure channel to given host and port.

This method is only used for testing purposes. Applications must use secure channels to communicate with services running on Spot.

Parameters
  • address – Connection host address.

  • port – Connection port.

  • authority – Authority option for the channel.

  • options – A list of additional parameters for the GRPC channel.

Returns

An insecure channel.

bosdyn.client.channel.translate_exception(rpc_error)[source]

Translated a GRPC error into an SDK RpcError.

Parameters

rpc_error – RPC error to translate.

Returns

Specific sub-type of RpcError.

bosdyn.client.channel.generate_channel_options(max_send_message_length=None, max_receive_message_length=None)[source]

Generate the array of options to specify in the creation of a client channel or server.

The list contains the values for max allowed message length for both sending and receiving. If no values are provided, the default values of 100 MB are used.

Parameters
  • max_send_message_length (int) – Max message length allowed for message to send.

  • max_receive_message_length (int) – Max message length allowed for message to receive.

Returns

Array with values for channel options.