Class SilaClient

class sila2.client.SilaClient(address: str, port: int, *, root_certs: bytes | None = None, private_key: bytes | None = None, cert_chain: bytes | None = None, insecure: bool = False)

SiLA Client, which is connected to a SiLA Server

Parameters:
  • address – IP address or hostname of the SiLA Server

  • port – Port of the SiLA Server

  • root_certs – PEM-encoded root certificates

  • private_key – PEM-encoded private key

  • cert_chain – PEM-encoded certificate chain

  • insecure – If True, no encryption will be used. Violates the SiLA 2 specification, only use for debugging purposes

Raises:

RuntimeError – If the server does not implement required features

Warning

Using unencrypted communication violates the SiLA specification and should only be used for testing purposes

SiLAService: SiLAServiceClient

This Feature MUST be implemented by each SiLA Server.

It specifies Commands and Properties to discover the Features a SiLA Server implements as well as details about the SiLA Server, like name, type, description, vendor and UUID.

Any interaction described in this feature MUST not affect the behaviour of any other Feature.

property address: str

SiLA Server IP address or hostname

property port: int

SiLA Server port

close() None

Close the connection to the SiLA Server, releasing all resources.

classmethod discover(*, server_name: str | None = None, server_uuid: UUID | str | None = None, timeout: float = 0, root_certs: bytes | None = None, private_key: bytes | None = None, cert_chain: bytes | None = None, insecure: bool = False) ClientCls

Use SiLA Server Discovery to connect to a SiLA Server. If multiple matching servers are found, the returned client is connected to one of them.

Parameters:
  • server_name – Only connect to SiLA Servers with this server name

  • server_uuid – Only connect to SiLA Servers with this server UUID

  • timeout – Time in seconds. If no matching server was found in this time, a TimeoutError will be raised

  • root_certs – PEM-encoded root certificates

  • private_key – PEM-encoded private key

  • cert_chain – PEM-encoded certificate chain

  • insecure – If True, no encryption will be used. Violates the SiLA 2 specification, only use for debugging purposes

Returns:

client – SiLA Client connected to a discovered matching SiLA Server (instance of the calling class)

Raises:
  • TimeoutError – If no server was found in the given time

  • RuntimeError – If a server was found but did not implement required features

Warning

Using unencrypted communication violates the SiLA specification and should only be used for testing purposes

clear_binary_transfer_download_cache() None

Delete all downloaded binary transfer data.