Skip to content

About

Interact with AAS V3.2 servers over HTTP using Python.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Eclipse aas-client3.2-python

Continuous integration Test coverage PyPI - version PyPI - Python Version Documentation

This is a client to interact with servers of Asset Administration Shells (AAS) over the HTTP/REST API, version 3.2, in Python.

The client works with the types of aas-core3.2, so you can directly send and receive the AAS models you create, verify and de/serialize with it. It implements all the operations of the specification, one function per operation, and does not depend on any particular HTTP library: you bring your own transport, or use the ready-made one based on requests.

Appetizer

Create a submodel in a Submodel Repository, read one of its values, and list all the submodels page by page:

import requests

import aas_core3_2.types as aas_types

from aas_client3_2 import http
from aas_client3_2 import pagination
from aas_client3_2 import requests_transport
from aas_client3_2 import submodel_repository

server = http.Server(
    transport=requests_transport.RequestsTransport(requests.Session()),
    base_url="http://localhost:5005",
)

submodel = aas_types.Submodel(
    id="https://example.com/ids/sm/appetizer",
    id_short="Appetizer",
    submodel_elements=[
        aas_types.Property(
            id_short="MaxRotationSpeed",
            value_type=aas_types.DataTypeDefXSD.INT,
            value="5000",
        )
    ],
)
submodel_repository.post_submodel(server, submodel)

print(
    submodel_repository.get_submodel_element_by_path_value_only(
        server, submodel.id, "MaxRotationSpeed"
    )
)
# Prints: 5000.0

for a_submodel in pagination.iterate(
    lambda cursor: submodel_repository.get_all_submodels(server, cursor=cursor)
):
    print(a_submodel.id)

Installation

Install the client together with the ready-made transport:

pip3 install aas-client3.2[requests]

To check servers against the specification, also install the testing client, aas-testing-client3.2, which mirrors the client with contracts on the requests and the responses.

Documentation

The documentation is available on: https://eclipse-aascw.github.io/aas-client3.2-python/

  • Getting started: the installation, a tutorial which creates and changes a shell with its submodels, and the errors, the pagination, the files, the transports and the authentication with OAuth 2 and OIDC,
  • Modules: a chapter with examples for every API, such as the repositories, the registries and the discovery,
  • API reference: all the functions, generated from the source code, and
  • Design: the architecture and the design decisions.

Specification

The client is based on the OpenAPI definitions of the HTTP/REST API from the Specification of the Asset Administration Shell, Part 2: API (IDTA-01002) version 3.2, available in admin-shell-io/aas-specs-api at v3.2.0. In particular:

Contributing

If you want to contribute, see our contributing guide.

About

Interact with AAS V3.2 servers over HTTP using Python.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages