Skip to main content

A client utility for the AICA API

Project description

Python AICA API Client

The AICA API client module provides simple functions for interacting with the API of the AICA Core.

pip install aica-api

The client can be used to easily make API calls as shown below:

from aica_api.client import AICA

aica = AICA()

aica.set_application('my_application.yaml')
aica.start_application()

aica.load_component('my_component')
aica.unload_component('my_component')

aica.stop_application()

To check the status of predicates and conditions, the following blocking methods can be employed:

from aica_api.client import AICA

aica = AICA()

if aica.wait_for_condition('timer_1_active', timeout=10.0):
    print('Condition is true!')
else:
    print('Timed out before condition was true')

if aica.wait_for_component_predicate('timer_1', 'is_timed_out', timeout=10.0):
    print('Predicate is true!')
else:
    print('Timed out before predicate was true')

Compatability table

The latest version of this AICA API client will generally support the latest AICA Core version. Major version changes to the API client or to AICA Core indicate breaking changes and are not always backwards compatible. To interact with older versions of AICA Core, it may be necessary to install older versions of the client. Use the following compatability table to determine which client version to use.

AICA Core version API protocol version Matching Python client version
4.x v2 >= 3.0.0
3.x v2 >= 2.0.0
2.x v2 1.2.0
<= 1.x v1 Unsupported

The API protocol version is a namespace for the endpoints. Endpoints under the v2 protocol have a /v2/... prefix in the URL. A change to the protocol version indicates a fundamental change to the API structure or behavior.

Between major version changes, minor updates to the AICA Core version and Python client versions may introduce new endpoints and functions respectively. If a function requires a feature that the detected AICA Core version does not yet support (as is the case when the Python client version is more up-to-date than the targeted AICA Core), then calling that function will return None with a warning.

Changes between major server versions

AICA Core versions v1.x and earlier were alpha and pre-alpha versions that are no longer supported.

AICA Core version v2.x was a beta version that introduced a new API structure under the v2 protocol namespace.

In AICA Core v3.x, live data streaming for predicates and conditions switched from using raw websockets to Socket.IO for data transfer. This constituted a breaking change to API clients, but the overall structure of the REST API remained the same, and so the API protocol version is still v2.

AICA Core versions v4.x and later keep the same protocol structure as before under the v2 namespace. The primary breaking change from the point of the API server and client is that the /version endpoint now returns the version of AICA Core, rather than the specific version of the API server subpackage inside core. These have historically carried the same major version, but in future the core version may have major updates without any breaking changes to the actual API server version.

Checking compatibility

Recent client versions include a check() method to assess the client version and API compatability.

from aica_api.client import AICA

aica = AICA()

# check compatability between the client version and API version
if aica.check():
    print('Client and server versions are compatible')
else:
    print('Client and server versions are incompatible')

The latest client versions also include the following functions to check the configuration details manually.

from aica_api.client import AICA

aica = AICA()

# get the current version of this client
print(aica.client_version())

# get the current version of AICA Core (e.g. "4.0.0")
print(aica.core_version())

# get the current API protocol version (e.g. "v2")
print(aica.protocol())

# get the specific version of the API server running in AICA Core (e.g. "4.0.1")
# (generally only needed for debugging purposes)
print(aica.api_version())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aica_api-3.0.0.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aica_api-3.0.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file aica_api-3.0.0.tar.gz.

File metadata

  • Download URL: aica_api-3.0.0.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for aica_api-3.0.0.tar.gz
Algorithm Hash digest
SHA256 7ab015a1e379aeac9b7be77f1492df9368c35fa9ab748a2aa76ea3c5227a1742
MD5 5fe077d541a0726565fca2ac8b5645b8
BLAKE2b-256 e5c4c9c2deeb05e49c1bf518b052fb7f9c215e0105c1ceddc6b46f688e7946cd

See more details on using hashes here.

File details

Details for the file aica_api-3.0.0-py3-none-any.whl.

File metadata

  • Download URL: aica_api-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for aica_api-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2787e5311edcd9c304efd29331ded412c9ab7e9031ee5e22cebe231d24b4b5ae
MD5 1000096afebb7211d806ba4a1495607f
BLAKE2b-256 a2d97ac55d23a3b7f21eeaf4c7c71e8869408f8b3c140e0b5563fedede3297ec

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page