from_environment#

static Configuration.from_environment()#

Create a PyPIM configuration based on the environment configuration.

Before calling this method, is_configured() should be called to check if the environment is configured to use PyPIM.

The environment configuration consists in setting the environment variable ANSYS_PLATFORM_INSTANCEMANAGEMENT_CONFIG to the path of the PyPIM configuration file. The configuration file is a simple JSON file containing the URI of the PIM API and the headers required to pass information.

The configuration file format is:

{
    "version": 1,
    "pim": {
        "uri": "dns:pim.svc.com:80",
        "headers": {
            "metadata-info": "value"
        },
        "tls": false
    }
}

A version 2 file replaces tls with a security block to select any supported transport (insecure, tls, uds, mtls, or wnua). See Security for the version 2 schema.

Returns:
Configuration

PyPIM configuration settings.

Raises:
NotConfiguredError

The environment is not configured to use PyPIM.

InvalidConfigurationError

The configuration is invalid.