PSI Fytotron API implementation
Photon System Instruments (PSI) develivers equipment accross the globe. Most of their cells are controlled by a fytotron PC, for which they also provide an optional API. To simplify the implementation and sharing of analysis workflows, we created an OpenAPI specification file and use the Openapi Generator to generate this package.
Installation & Usage
Unfortunately currently only available on test pypi, installable with: python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple psi-fytotron
pip install psi-fytotron
Build and tested with python 3.8 on windows 10
Cross platform support for Linux, macOS and Windows
Example implementation
Uses a .env file with the following fields:
URL: <"http://<ip-address/path>:<poort>/fyto/rest"
TOKEN: <Fytotron API access token>
The environment files have one additional depency: pip install python-dotenv
Example code:
https://github.com/NPEC-NL/PSI-Fytotron-API/blob/main/example_implementation.py?plain=1#L2-L32
Contributing
We welcome contributions! If you encounter bugs, have feature requests, or want to suggest improvements, please create an issue and provide a clear description.
Setting up a Development Environment
Requires Python 3.9+
1. Create a virtual environment (venv):
sh
python -m venv .venv
2. Activate the venv:
- On Windows:
sh
.venv\Scripts\activate
- On macOS/Linux:
sh
source .venv/bin/activate
3. Install the package with build and test dependencies:
```sh
pip install .[build, test]
Updating the OpenAPI specification file
The API is automatically generated from the OpenAPI specification file with the openapi generator cli. The workflows automatically build the client and copy the files to the right folders.
Documentation
Build with mkdocs-material
Documentation for API Endpoints
All URIs are relative to https://localhost:8000/fyto/rest
| Class | Method | HTTP request | Description |
|---|---|---|---|
| FytotronApi | getvar | GET /getvar | Returns the current value of the variable |
| FytotronApi | info | GET /info | Returns all setpoints and actual values in the database. |
| FytotronApi | monitor | GET /monitor | Returns the current status of the fytotron |
| FytotronApi | setvar | POST /setvar | Set the setpoint value |
Documentation For Models
Documentation For Authorization
Authentication schemes defined for the API:
ApiKeyAuth
- Type: API key
- API key parameter name: X-Auth-Token
- Location: HTTP header