...
The Dashboards application is part of the Opal One software suite developed by OPAL-RT. This software suite comes with a REST API (HTTP protocol) to ensure communication between the UI (User Interface) and the backend server.
The Extended Python API for Dashboards is a wrapper on top of that REST API. It allows interaction with the backend server using a Python script. This Python script takes the role of “yet another client”, just like the Dashboards UI.
The main goal of having a Python client is to automate interactions with the backend server. This allows the user to rapidly and programmatically create panels, widgets, connections and so on.
The two layers of the Python API
There are two layers composing the Python API. The one presented in this documentation is a high-level wrapper designed on top of a low-level API.
Whenever the
...
term “Python API” is mentioned in this documentation, the reader
...
shall see this as the high-level wrapper API, unless specified otherwise.
After installation of the high-level Python API, the user can observe two Python packages related to OPAL-RT when running the command pip list
:
opalone: The high-level, user API (users shall use this one)
opal-unified-api-client: The low-level API (users shall avoid using this one directly).
Installing
The installation of Dashboards includes a set of Python wheels that can be installed in the Python environment of your choice. You can find the wheel files in your Opal One installation folder. To install the wheels:
Code Block | ||||
---|---|---|---|---|
| ||||
python C:\OPAL-RT\OpalOne\<version>\api\client\python\install_opalone_api.py |
Tip |
---|
In the above command, replace |
Note |
---|
The above command assumes you have a functional Python interpreter, version 3.7+ installed on your machine and that you also have the path to the |
...
For HYPERSIM users
In the HYPERSIM context, the folder C:\OPAL-RT\OpalOne\<version>\api\client\python
does not exist. Instead, the wheels can be found in C:\OPAL-RT\HYPERSIM\<hs_version>\Windows\OpalOne\api\client\python
.
...
refer to the pip documentation. |
Example scripts
...
Description
...
File
...
1
...
2
(1) Print information about datapoints of a given project Download print_datapoints_example.py Usage:
|
...
...
3
(2) A step by step example to generate a panel for a project Download panel_creation_example.py Usage:
|
...
(3) Run model simulations of a given project Download simulations_example.py Usage:
|
...
(4) Export a panel to a JSON file Download export_panel_example.py Usage:
| ||
(5) Import a panel from a JSON file Download import_panel_example.py Usage:
|
Uninstalling
To uninstall the wheel packages from your Python installation, run the following command:
Code Block | ||||
---|---|---|---|---|
| ||||
pip uninstall opalone opal-unified-api-client |
Answer yes if/when prompted.