Skip to content

ConfigurationService

ConfigurationService(rest)

Bases: ObjectService

Source code in TM1py/Services/ConfigurationService.py
def __init__(self, rest: RestService):
    super().__init__(rest)

get_active(**kwargs)

Read effective(!) TM1 config settings as dictionary from TM1 Server

Returns:

Type Description
Dict

config as dictionary

Source code in TM1py/Services/ConfigurationService.py
@require_ops_admin
def get_active(self, **kwargs) -> Dict:
    """Read effective(!) TM1 config settings as dictionary from TM1 Server

    :return: config as dictionary
    """
    url = "/ActiveConfiguration"
    config = self._rest.GET(url, **kwargs).json()
    del config["@odata.context"]
    return config

get_admin_host(**kwargs)

Source code in TM1py/Services/ConfigurationService.py
@deprecated_in_version(version="12.0.0")
def get_admin_host(self, **kwargs) -> str:
    url = "/Configuration/AdminHost/$value"
    return self._rest.GET(url, **kwargs).text

get_all(**kwargs)

Source code in TM1py/Services/ConfigurationService.py
def get_all(self, **kwargs) -> Dict:
    url = "/Configuration"
    config = self._rest.GET(url, **kwargs).json()
    del config["@odata.context"]
    return config

get_data_directory(**kwargs)

Source code in TM1py/Services/ConfigurationService.py
@deprecated_in_version(version="12.0.0")
def get_data_directory(self, **kwargs) -> str:
    url = "/Configuration/DataBaseDirectory/$value"
    return self._rest.GET(url, **kwargs).text

get_product_version(**kwargs)

Ask TM1 Server for its version

:Returns: String, the version

Source code in TM1py/Services/ConfigurationService.py
def get_product_version(self, **kwargs) -> str:
    """Ask TM1 Server for its version

    :Returns:
        String, the version
    """
    url = "/Configuration/ProductVersion/$value"
    return self._rest.GET(url, **kwargs).text

get_server_name(**kwargs)

Ask TM1 Server for its name

:Returns: String, the server name

Source code in TM1py/Services/ConfigurationService.py
def get_server_name(self, **kwargs) -> str:
    """Ask TM1 Server for its name

    :Returns:
        String, the server name
    """
    url = "/Configuration/ServerName/$value"
    return self._rest.GET(url, **kwargs).text

get_static(**kwargs)

Read TM1 config settings as dictionary from TM1 Server

Returns:

Type Description
Dict

config as dictionary

Source code in TM1py/Services/ConfigurationService.py
@require_ops_admin
def get_static(self, **kwargs) -> Dict:
    """Read TM1 config settings as dictionary from TM1 Server

    :return: config as dictionary
    """
    url = "/StaticConfiguration"
    config = self._rest.GET(url, **kwargs).json()
    del config["@odata.context"]
    return config

update_static(configuration)

Update the .cfg file and triggers TM1 to re-read the file.

Parameters:

Name Type Description Default
configuration Dict
required

Returns:

Type Description
Response

Response

Source code in TM1py/Services/ConfigurationService.py
@require_ops_admin
def update_static(self, configuration: Dict) -> Response:
    """Update the .cfg file and triggers TM1 to re-read the file.

    :param configuration:
    :return: Response
    """
    url = "/StaticConfiguration"
    return self._rest.PATCH(url, json.dumps(configuration))