Skip to content

rwth-iat/aas-python-http-client

Repository files navigation

aas-python-http-client

Warning

This client library was generated using swagger-codegen, but the generated model classes were replaced with models from the Basyx-Python-SDK.

This means:

  • You can directly use objects from basyx.aas.model
  • Example: you can pass a basyx.aas.model.Submodel("some_id") into client API functions

Mostly generated python client for AAS API based on models from Basyx-Python-SDK.

All APIs of the Specification of the Specification of the Asset Administration Shell: Part 2 in one collection.

This Python package is automatically generated by the Swagger Codegen project:

  • API version: V3.0.1
  • Package version: 1.0.0
  • Build package: io.swagger.codegen.v3.generators.python.PythonClientCodegen

Requirements.

Python 3.9+

Installation & Usage

pip install

You can install the python package directly from Github

pip install aas-python-http-client

(you may need to run pip with root permission: sudo pip install git+https://github.com/rwth-iat/aas-python-http-client.git)

Then import the package:

import aas_python_http_client 

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import aas_python_http_client

Getting Started

Please follow the installation procedure and then run the following:

from aas_python_http_client import ApiClient, Configuration, AssetAdministrationShellRepositoryAPIApi, \
    SubmodelRepositoryAPIApi
from aas_python_http_client.util import string_to_base64url
from basyx.aas import model

configuration = Configuration()
configuration.host = "http://localhost:8080/api/v3.0"

api_client = ApiClient(configuration=configuration)

aasRepoClient = AssetAdministrationShellRepositoryAPIApi(api_client=api_client)

# query all asset administration shells
all_aas = aasRepoClient.get_all_asset_administration_shells().result
print(all_aas)

# query specific asset administration shell
aas = aasRepoClient.get_asset_administration_shell_by_id(
    string_to_base64url('https://acplt.org/Test_AssetAdministrationShell'))
print(aas)

# query asset information
aas_info = aasRepoClient.get_asset_information_aas_repository(
    string_to_base64url('https://acplt.org/Test_AssetAdministrationShell'))
print(aas_info)

# create a new asset administration shell
new_aas = model.AssetAdministrationShell(aas_info, "https://acplt.org/Test_AAS")
aasRepoClient.post_asset_administration_shell(new_aas)

submodelRepoClient = SubmodelRepositoryAPIApi(api_client=api_client)

# query all submodels
all_submodels = submodelRepoClient.get_all_submodels().result
print(all_submodels)

# modify a submodel
test_submodel = all_submodels[0]
test_submodel.id_short = "Test123"
submodelRepoClient.put_submodel_by_id(test_submodel, string_to_base64url(test_submodel.id))

# delete a submodel
submodelRepoClient.delete_submodel_by_id(string_to_base64url(test_submodel.id))

# create a new submodel
new_submodel = model.Submodel("https://acplt.org/TestSubmodel")
submodelRepoClient.post_submodel(new_submodel)

About

Mostly generated python client for AAS API based on models from Basyx-Python-SDK

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 5