API Reference#

Welcome to PyPIM API documentation. Use the search feature or click the links in the navigation pane to view API documentation.

Entry point for the PIM Python client library.

ansys.platform.instancemanagement.connect() ansys.platform.instancemanagement.client.Client#

Create a PyPIM client 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
    }
}
Returns
Client

PyPIM client, which is the main entry point to using this library.

Raises
NotConfiguredError

The environment is not configured to use PyPIM.

InvalidConfigurationError

The configuration is invalid.

Examples

>>> import ansys.platform.instancemanagement as pypim
>>> if pypim.is_configured():
>>>     client = pypim.connect()
>>>     # use the client
>>>     client.close()
>>> import ansys.platform.instancemanagement as pypim
>>> if pypim.is_configured():
>>>     with pypim.connect() as client:
>>>         # use client
ansys.platform.instancemanagement.is_configured() bool#

Check if the environment is configured to use PyPIM.

Returns
bool

True when the environment is configured to use PyPIM, False otherwise.

Client

Provides an high-level client object for interacting with the PIM API.

Definition

Provides a definition of a product that can be started using the PIM API.

Instance

Provides a remote instance of a product.

Service

Provides an entry point for communicating with a remote product.

NotConfiguredError

Indicates an attempt was made to use PyPIM without the mandatory configuration.

InstanceNotReadyError

Indicates an attempt was made to communicate with an instance that is not yet ready.

UnsupportedServiceError

Indicates an attempt was made to communicate with an instance using a service that is not supported.

InvalidConfigurationError

Indicates PyPIM is configured, but the configuration is invalid.

UnsupportedProductError

Indicates that the product or version is not supported by the remote server.