Skip to content

Fraunhofer-IIS/pyjapi

Repository files navigation

pyjapi - Python JAPI Client

Using Hatch Code style: black Ruff

Getting Started

pip install pyjapi

Alternatively, you might want to clone the project and go from there:

git clone [email protected]:Fraunhofer-IIS/pyjapi.git
pip install -e pyjapi/.

Usage

japi [--host HOSTNAME] [--port N] [--format FORMAT_NAME] [-v] (list|listen|request)

Examples

Issue individual JAPI commands

  • japi request <JAPI_COMMAND>

    $ japi request get_temperature
    > get_temperature() #2a96d8
    < get_temperature() #2a96d8 --> temperature=17.0
  • japi request <COMMAND> [PARAMETERS]

    $ japi request get_temperature unit=kelvin
    > get_temperature(unit="kelvin") #02c6fa
    < get_temperature(unit="kelvin") #02c6fa --> temperature=290.0

List available push services

  • japi list

    $ japi list
    > japi_pushsrv_list() #4fae82
    < japi_pushsrv_list() #4fae82 --> services=["push_temperature"]

Listen to JAPI push services

  • japi listen <PUSH_SERVICE_NAME> <N_PACKAGES>

    $ japi listen push_temperature 3
    > japi_pushsrv_subscribe(service="push_temperature") #b71d22
    < push_temperature() --> temperature=24.833269096274833
    < push_temperature() --> temperature=25.414709848078964
    < push_temperature() --> temperature=25.912073600614352