mindsphere_core package¶
Submodules¶
mindsphere_core.commonutil module¶
-
exception
APIError
(status_code, message)[source]¶ Bases:
Exception
-
args
¶
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
exception
APIErrorResponse
(status_code=None, message=None, log_ref=None, time_stamp=None, error=None, exception=None, path=None)[source]¶ Bases:
Exception
-
args
¶
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
mindsphere_core.constants module¶
mindsphere_core.error_messages module¶
mindsphere_core.exceptions module¶
-
exception
MindsphereClientConfigurationError
(message, error=None, http_status=None, log_ref=None)[source]¶ Bases:
mindsphere_core.exceptions.MindsphereClientError
Class for exceptions raised because of any incorrect/missing client configuration.
-
args
¶
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
exception
MindsphereClientError
(message, error=None, http_status=None, log_ref=None)[source]¶ Bases:
mindsphere_core.exceptions.MindsphereError
Class for exceptions raised during any error caused by client input.
-
args
¶
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
exception
MindsphereError
(message, error=None, http_status=None, log_ref=None)[source]¶ Bases:
Exception
Base class for mindspshere exceptions.
-
args
¶
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
exception
MindsphereForbiddenAccessError
(message, error=None, http_status=None, log_ref=None)[source]¶ Bases:
mindsphere_core.exceptions.MindsphereClientError
Class for exceptions raised during any authorization error.
-
args
¶
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
exception
MindsphereServerError
(message, error=None, http_status=None, log_ref=None)[source]¶ Bases:
mindsphere_core.exceptions.MindsphereError
Class for exceptions raised during any error received from api server.
-
args
¶
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
mindsphere_core.identification module¶
Technical Token Manager API
This API provides operations to manage your access to customer IoT data. The operations return a Technical Token, which gives access to the tenant’s IoT data. # noqa: E501
-
class
Identification
(app_name=None, app_version=None, host_tenant=None, user_tenant=None)[source]¶ Bases:
object
- Attributes:
- attribute_types (dict): The key is attribute name
- and the value is attribute type.
- attribute_map (dict): The key is attribute name
- and the value is json key in definition.
-
app_name
¶ Gets the app_name of this Identification. Name of the application from Operator/Developer Cockpit
Returns: The app_name of this Identification. Return type: str
-
app_version
¶ Gets the app_version of this Identification. Version of the application as given in Operation/Developer Cockpit.
Returns: The app_version of this Identification. Return type: str
-
attribute_map
= {'app_name': 'appName', 'app_version': 'appVersion', 'host_tenant': 'hostTenant', 'user_tenant': 'userTenant'}¶
-
attribute_types
= {'app_name': 'str', 'app_version': 'str', 'host_tenant': 'str', 'user_tenant': 'str'}¶
-
host_tenant
¶ Gets the host_tenant of this Identification. Tenant ID of the developer/operator tenant hosting the application.
Returns: The host_tenant of this Identification. Return type: str
-
user_tenant
¶ Gets the user_tenant of this Identification. Tenant ID of the tenant owning the data to be accessed with the Technical Token.
Returns: The user_tenant of this Identification. Return type: str
mindsphere_core.log_config module¶
mindsphere_core.mindsphere_core module¶
This module implements the common features of sdk used by all clients.
Copyright (C), Siemens AG 2018 Licensed under the MindSphere Developer License, see LICENSE.md.
-
class
RestClientConfig
(proxy_host=None, proxy_port=None, proxy_username=None, proxy_password=None, connection_timeout_in_seconds=100, socket_timeout_in_seconds=100, proxy_schema='http', host_environment=None)[source]¶ Bases:
object
This class allows to configure proxy , timeout and hosting environment.
- proxy_host : str
- Proxy host
- proxy_username : str
- Proxy User name
- proxy_port : str
- Proxy port
- proxy_password : str
- Proxy password
- connection_timeout_in_seconds : str
- Connection timeout
- socket_timeout_in_seconds : str
- Socket timeout
- proxy_schema : str
- Proxy schema
- host_environment : str
- Target hosted environment
-
build_url
(base_path, end_point_url, config=None)[source]¶ builds the end point url based on host environment.
- base_path : str
- base path for the selected service
- end_point_url : str
- url for the requested service end point
- config : RestClientConfig
- config object set by user
mindsphere_core.mindsphere_credentials module¶
-
class
AppCredentials
(app_name=None, app_version=None, key_store_client_id=None, key_store_client_secret=None, host_tenant=None, user_tenant=None, authorization=None)[source]¶ Bases:
object
This class allows to configure app credentials.
- app_name : str
- Application name
- app_version : str
- Application version
- key_store_client_id : str
- Key store client Id
- key_store_client_secret : str
- Key store client Secret
- host_tenant : str
- Host Tenant
- user_tenant : str
- User tenant name
-
cached_token
¶
-
class
TenantCredentials
(client_id=None, client_secret=None, tenant=None, sub_tenant=None, use_sub_tenant=None)[source]¶ Bases:
object
This class allows to configure tenant credentials.
- client_id : str
- Client Id
- client_secret : str
- Client secret
- tenant : str
- Tenant name
- sub_tenant : str
- Sub tenant name
- use_sub_tenant : bool
- Boolean to indicate if subtenant will be used to get token
-
cached_token
¶
mindsphere_core.serialization_filter module¶
-
__deserialize
(data, klass)[source]¶ Deserializes dict, list, str into an object.
Parameters: - data (object) – dict, list or str.
- klass – class literal, or string of class name.
Returns: object.
-
__deserialize_date
(string)[source]¶ Deserializes string to date.
Parameters: string – str. Returns: date.
-
__deserialize_datetime
(string)[source]¶ Deserializes string to datetime.
The string should be in iso8601 datetime format.
Parameters: string – str. Returns: datetime.
-
__deserialize_file
(response)[source]¶ Deserializes body to file
Saves response body into a file in a temporary folder, using the filename from the Content-Disposition header if provided.
Parameters: response – RESTResponse. Returns: file path.
-
__deserialize_model
(data, klass)[source]¶ Deserializes list or dict to model.
Parameters: - data – dict, list.
- klass – class literal.
Returns: model object.
-
__deserialize_primitive
(data, klass)[source]¶ Deserializes string to primitive type.
Parameters: - data – str.
- klass – class literal.
Returns: int, long, float, str, bool.
-
deserialize
(response, response_type)[source]¶ Deserializes response into an object.
Parameters: - response – RESTResponse object to be deserialized.
- response_type – class literal for deserialized object, or string of class name.
Returns: deserialized object.
-
sanitize_for_serialization
(obj)[source]¶ Builds a JSON POST object. If obj is None, return None. If obj is str, int, long, float, bool, return directly. If obj is datetime.datetime, datetime. date convert to string in iso8601 format. If obj is list, sanitize each element in the list. If obj is dict, return the dict. If obj is swagger model, return the properties dict.
Parameters: obj – The data to serialize. Returns: The serialized form of data.
mindsphere_core.token_service module¶
-
_invoke_token_endpoint
(rest_client_config, client_id, client_secret, tenant, sub_tenant=None)[source]¶ Method to fetch authorization token to preauthorize the service calls.
Module contents¶
mindsphere_core¶
The MindSphere SDK Java Core provides many core features like authorization , token handling , exception handling , api invoker , logging features etc. Mindsphere SDK Core is used as a dependency in auto-generated Mindsphere service SDKs to have all functionalities of SDK core.
Copyright (C), Siemens AG 2018 Licensed under the MindSphere Developer License, see LICENSE.md.
-
class
RestClientConfig
(proxy_host=None, proxy_port=None, proxy_username=None, proxy_password=None, connection_timeout_in_seconds=100, socket_timeout_in_seconds=100, proxy_schema='http', host_environment=None)[source]¶ Bases:
object
This class allows to configure proxy , timeout and hosting environment.
- proxy_host : str
- Proxy host
- proxy_username : str
- Proxy User name
- proxy_port : str
- Proxy port
- proxy_password : str
- Proxy password
- connection_timeout_in_seconds : str
- Connection timeout
- socket_timeout_in_seconds : str
- Socket timeout
- proxy_schema : str
- Proxy schema
- host_environment : str
- Target hosted environment
-
class
AppCredentials
(app_name=None, app_version=None, key_store_client_id=None, key_store_client_secret=None, host_tenant=None, user_tenant=None, authorization=None)[source]¶ Bases:
object
This class allows to configure app credentials.
- app_name : str
- Application name
- app_version : str
- Application version
- key_store_client_id : str
- Key store client Id
- key_store_client_secret : str
- Key store client Secret
- host_tenant : str
- Host Tenant
- user_tenant : str
- User tenant name
-
cached_token
¶
-
class
TenantCredentials
(client_id=None, client_secret=None, tenant=None, sub_tenant=None, use_sub_tenant=None)[source]¶ Bases:
object
This class allows to configure tenant credentials.
- client_id : str
- Client Id
- client_secret : str
- Client secret
- tenant : str
- Tenant name
- sub_tenant : str
- Sub tenant name
- use_sub_tenant : bool
- Boolean to indicate if subtenant will be used to get token
-
cached_token
¶