systemlink.clients.core

class systemlink.clients.core.ApiError[source]

Represents the standard error structure for SystemLink API responses.

property args

The list of positional arguments formatted into the error.

Return type

List[str]

property code

The numeric code associated with the error.

Return type

Optional[int]

copy()[source]

Get a copy of this object.

Return type

ApiError

property inner_errors

The list of inner errors.

Return type

List[ApiError]

property message

The error message.

Return type

Optional[str]

property name

The name of the error.

Return type

Optional[str]

property resource_id

The ID of the resource associated with the error, if any.

Set resource_type when setting this property.

Return type

Optional[str]

property resource_type

The type of resource associated with the error, if any.

Set this when setting resource_id.

Return type

Optional[str]

exception systemlink.clients.core.ApiException(message=None, error=None, http_status_code=None, inner=None)[source]

Represents errors that occur when calling SystemLink APIs.

__init__(message=None, error=None, http_status_code=None, inner=None)[source]

Initialize an exception.

Parameters
  • message (Optional[str]) – The message describing the error.

  • error (Optional[ApiError]) – The error returned by the API.

  • http_status_code (Optional[int]) – The HTTP status code, if this exception was the result of an HTTP error.

  • inner (Optional[Exception]) – The inner exception that caused the error.

property error

The error information returned by the SystemLink API, or None if the API did not return one or the error occurred trying to call the API.

Return type

Optional[ApiError]

property http_status_code

The HTTP status code, if this exception was the result of an HTTP error.

Return type

Optional[int]

property inner_exception

The exception that caused this failure, if any.

Return type

Optional[Exception]

property message

The error message.

Return type

Optional[str]

with_traceback()

Exception.with_traceback(tb) – set self.to tb and return self.

class systemlink.clients.core.CloudHttpConfiguration(api_key)[source]

An HttpConfiguration specifically for use with SystemLink Cloud.

__init__(api_key)[source]

Initialize a configuration for SystemLink Cloud using API key-based authentication.

Parameters

api_key (str) – The API key to send with requests.

Raises

ValueError – if api_key is empty.

property api_keys

The available API keys to use for authorization, or None if none were provided.

Return type

Optional[Dict[str, str]]

property cert_path

Local path to an SSL certificate file.

Return type

Optional[pathlib.Path]

property password

The password to use for HTTP authentication, or None if none was provided.

Return type

Optional[str]

property server_uri

The urllib.parse.urlparse().scheme, urllib.parse.urlparse().hostname, and urllib.parse.urlparse().port of the web server hosting the SystemLink service to connect to.

Additional Uri properties such as urllib.parse.urlparse().path and urllib.parse.urlparse().query are ignored.

Return type

str

property timeout_milliseconds

The number of milliseconds before a request times out with an error.

Changing the timeout will not affect APIs that have already read the configuration.

Return type

int

property user_agent

The string to pass the web server as the product name or names making the request, or None to use a library-specific default.

Changing the user-agent will not affect APIs that have already read the configuration.

Return type

Optional[str]

property username

The username to use for HTTP authentication, or None if none was provided.

Return type

Optional[str]

class systemlink.clients.core.HttpConfiguration(server_uri, api_key=None, username=None, password=None, cert_path=None)[source]

Represents the configuration for accessing a SystemLink service over HTTP.

DEFAULT_TIMEOUT_MILLISECONDS = 60000

The default value of timeout_milliseconds to use when making API calls.

__init__(server_uri, api_key=None, username=None, password=None, cert_path=None)[source]

Initialize a configuration.

If neither api_key nor username and password are set, the configuration will use anonymous access, and any API calls that require authorization will fail.

Parameters
  • server_uri (str) – The scheme, host, and port (if not default) of the web server hosting the SystemLink service to connect to. Additional Uri properties such as urllib.parse.urlparse().path and urllib.parse.urlparse().query are ignored.

  • api_key (Optional[str]) – The API key to send with requests.

  • username (Optional[str]) – The name of the user to use when authorization is required.

  • password (Optional[str]) – The user’s password to use when authorization is required.

  • cert_path (Optional[pathlib.Path]) – Local path to an SSL certificate file.

Raises
  • ValueError – if server_uri is missing scheme or host information.

  • ValueError – if username or password is set, but not both.

property api_keys

The available API keys to use for authorization, or None if none were provided.

Return type

Optional[Dict[str, str]]

property cert_path

Local path to an SSL certificate file.

Return type

Optional[pathlib.Path]

property password

The password to use for HTTP authentication, or None if none was provided.

Return type

Optional[str]

property server_uri

The urllib.parse.urlparse().scheme, urllib.parse.urlparse().hostname, and urllib.parse.urlparse().port of the web server hosting the SystemLink service to connect to.

Additional Uri properties such as urllib.parse.urlparse().path and urllib.parse.urlparse().query are ignored.

Return type

str

property timeout_milliseconds

The number of milliseconds before a request times out with an error.

Changing the timeout will not affect APIs that have already read the configuration.

Return type

int

property user_agent

The string to pass the web server as the product name or names making the request, or None to use a library-specific default.

Changing the user-agent will not affect APIs that have already read the configuration.

Return type

Optional[str]

property username

The username to use for HTTP authentication, or None if none was provided.

Return type

Optional[str]

class systemlink.clients.core.HttpConfigurationManager[source]

Factory for HttpConfiguration objects.

HTTP_LOCALHOST_CONFIGURATION_ID = 'SYSTEMLINK_LOCALHOST'

The default ID of the SystemLink Server’s configuration on the SystemLink Server itself.

HTTP_MASTER_CONFIGURATION_ID = 'SYSTEMLINK_MASTER'

The default ID of the SystemLink Server’s configuration on systems registered using SystemLink Client.

classmethod get_configuration(id=None, enable_fallbacks=True)[source]

Get the requested or default configuration.

Parameters
  • id (Optional[str]) – The ID of the configuration to find.

  • enable_fallbacks (Optional[bool]) – Whether or not to fallback to other known configurations, if id is unavailable.

Return type

HttpConfiguration

Returns

The configuration.

Raises
  • ValueError – if id is None and enable_fallbacks is False.

  • ApiException – if the specified (or default) configuration is not found.