PyStclient

class pystclient.clients.PyStclient

Bases: object

STC Python client.

Handles OAuth2 authentication (including token caching and refresh) and exposes sub-clients for interacting with different areas of the STC platform:

  • project — create, configure, and manage projects

  • model — upload, search, and delete FMU models

  • simulator — provision, control, and monitor simulators

  • measurement — query simulation result data

Subclasses must call authenticate() after construction to establish an authenticated session before using the sub-clients.

__init__() None

Methods

__init__()

authenticate([token])

Establish an authenticated session with the STC API.

Attributes

token

Access the current OAuth2 token used for API requests.

authenticate(token: dict[str, str] | OAuth2Token | None = None) dict[str, str] | OAuth2Token

Establish an authenticated session with the STC API.

Attempts to reuse an existing or cached token. If no valid token is available (or the cached token has expired), an interactive OAuth2 authorization-code flow is initiated — a browser window is opened for the user to log in, and the resulting token is cached for future sessions.

This method must be called before using any of the sub-clients (project, model, simulator, measurement).

Parameters:
  • token – A pre-existing token to use instead of performing authentication. When None,

  • disk.l (the client first checks for a cached token on)

Returns:

The active authentication token for the session

measurement: MeasurementClient
model: ModelClient
project: ProjectClient
simulator: SimulatorClient
property token: dict[str, str] | OAuth2Token

Access the current OAuth2 token used for API requests.

Returns:

The active authentication token (may be a cached or freshly issued token)