:py:mod:`viam.rpc.dial` ======================= .. py:module:: viam.rpc.dial Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: viam.rpc.dial.Credentials viam.rpc.dial.DialOptions viam.rpc.dial.AuthenticatedChannel viam.rpc.dial.ViamChannel Functions ~~~~~~~~~ .. autoapisummary:: viam.rpc.dial.dial viam.rpc.dial.dial_direct Attributes ~~~~~~~~~~ .. autoapisummary:: viam.rpc.dial.LOGGER .. py:data:: LOGGER .. py:class:: Credentials Credentials to connect to the robot and the Viam app. .. py:attribute:: type :type: Union[Literal[robot-location-secret], Literal[robot-secret], Literal[api-key]] The type of credential .. py:attribute:: payload :type: str The credential .. py:class:: DialOptions(disable_webrtc: bool = False, auth_entity: Optional[str] = None, credentials: Optional[Credentials] = None, insecure: bool = False, allow_insecure_downgrade: bool = False, allow_insecure_with_creds_downgrade: bool = False, max_reconnect_attempts: int = 3, timeout: float = 20) .. py:attribute:: disable_webrtc :type: bool Bypass Web RTC and connect directly to the robot. .. py:attribute:: auth_entity :type: Optional[str] The URL to authenticate against. Should be used if the address passed in and FQDN of the server do not match. .. py:attribute:: credentials :type: Optional[Credentials] Credentials for connecting to the robot .. py:attribute:: insecure :type: bool :value: False Determine if the RPC connection is TLS based. Must be provided to establish an insecure connection. Otherwise, a TLS based connection will be assumed. .. py:attribute:: allow_insecure_downgrade :type: bool :value: False Allow the RPC connection to be downgraded to an insecure connection if detected. This is only used when credentials are not present. .. py:attribute:: allow_insecure_with_creds_downgrade :type: bool :value: False Allow the RPC connection to be downgraded to an insecure connection if detected, even with credentials present. This is generally unsafe to use, but can be requested. .. py:attribute:: max_reconnect_attempts :type: int :value: 3 Max number of times the client attempts to reconnect when connection is lost .. py:attribute:: timeout :type: float :value: 20 Number of seconds before the dial connection times out Set to 20sec to match _defaultOfferDeadline in goutils/rpc/wrtc_call_queue.go .. py:method:: with_api_key(api_key: str, api_key_id: str) -> typing_extensions.Self :classmethod: Create DialOptions with an API key for credentials and default values for other arguments. :param api_key: your API key :type api_key: str :param api_key_id: your API key ID. Must be a valid UUID :type api_key_id: str :raises ValueError: Raised if the api_key_id is not a valid UUID :returns: the DialOptions :rtype: Self .. py:class:: AuthenticatedChannel(host: Optional[str] = None, port: Optional[int] = None, *, ssl: Union[None, bool, AuthenticatedChannel.__init__.ssl] = None, server_hostname: Optional[str] = None) Bases: :py:obj:`grpclib.client.Channel` Represents a connection to the server, which can be used with generated stub classes to perform gRPC calls. .. code-block:: python3 channel = Channel() client = cafe_grpc.CoffeeMachineStub(channel) ... request = cafe_pb2.LatteOrder( size=cafe_pb2.SMALL, temperature=70, sugar=3, ) reply: empty_pb2.Empty = await client.MakeLatte(request) ... channel.close() .. py:method:: request(name: str, cardinality: grpclib.const.Cardinality, request_type: Type[grpclib.stream._SendType], reply_type: Type[grpclib.stream._RecvType], *, timeout: Optional[float] = None, deadline: Optional[grpclib.metadata.Deadline] = None, metadata: Optional[grpclib.metadata._MetadataLike] = None) -> grpclib.client.Stream[grpclib.stream._SendType, grpclib.stream._RecvType] .. py:method:: close() -> None Closes connection to the server. .. py:class:: ViamChannel .. py:attribute:: channel :type: grpclib.client.Channel .. py:attribute:: release :type: Callable[[], None] .. py:method:: close() .. py:method:: __del__() .. py:method:: __aenter__() :async: .. py:method:: __aexit__(exc_type, exc_value, traceback) :async: .. py:function:: dial(address: str, options: Optional[DialOptions] = None) -> ViamChannel :async: .. py:function:: dial_direct(address: str, options: Optional[DialOptions] = None) -> grpclib.client.Channel :async: