trendminer.sdk.client module

class trendminer.sdk.client.Client(token: str | dict, url: str | None = None, tz: str | ~pytz.tzinfo.BaseTzInfo | None = <UTC>)

Bases: ABC

The Client class provides a versatile interface for interacting with the TrendMiner appliance, granting access to various functionalities. It supports flexible configuration options, customizable timezone settings for accurate time-related outputs. Users can utilize a range of properties to manage assets, explore context-related objects, access machine learning functionalities, perform searches across different data types, explore TrendHub views, and manipulate tags associated with data elements.

By offering this comprehensive set of properties, the Client facilitates seamless navigation and utilization of TrendMiner’s features and capabilities.

token

Valid Keycloak token. When setting the token directly, do not set the client or user

Type:

str, optional

url

TrendMiner appliance url

Type:

str, optional

tz

Client timezone. All time outputs given in client timezone. All inputs without explicit timezone are considered to be in the client timezone, default utc

Type:

str or BaseTzInfo, optional

Example

from trendminer import TrendMinerClient

#Create a Client instance whicle working from within a TrendMiner environment
client = TrendMinerClient.from_token('<oauth2_token>')

#Interacting with machine learning module
pmml_api = client.ml.pmml
pmml_models = pmml_api.list()

#Interacting with search module
search_api = client.search
#Interacting with value based search module
value = search_api.value.get_by_name('vbs_name')

#Interacting with tag module
tag_api = client.tag
tag = tag_api.get_by_name('tag_name')

#Interacting with trendhub view module
view_api = client.view
view = view_api.get_by_name('view_name')

#Interacting with context module
context_api = client.context
context = context_api.field.get_by_name('context_field_name')
abstract property asset: AssetAPI

Asset API acts as a router to assets and attributes module

Returns:

An instance of the AssetAPI class

Return type:

AssetAPI

Example

asset_api = client.asset
abstract property context: ContextAPI

ContextAPI for objects related to ContextHub and context items

Returns:

An instance of the ContextAPI class

Return type:

ContextAPI

Example

client.context
abstract property ml: MlModelsAPI

MlModelsAPI for models-related objects

Returns:

An instance of the MlModelsAPI class

Return type:

MlModelsAPI

Example

ml_api = client.ml
abstract property search: SearchAPI

Parent SearchAPI for all search types

Returns:

An instance of the SearchAPI class

Return type:

SearchAPI

Example

client.search
abstract property tag: TagAPI

TagAPI for retrieving and instantiating tags.

Returns:

An instance of the TagAPI class

Return type:

TagAPI

Example

client.tag
abstract property view: TrendViewAPI

TrendHubViewAPI for TrendHub views.

Returns:

An instance of the TrendViewAPI class

Return type:

TrendViewAPI

Example

view_api = client.view