discovery

aas_client3_2.discovery implements the Asset Administration Shell Basic Discovery API: it links the shells to the IDs of their assets, such as a serial number, so that you find the shells of an asset you have at hand.

import requests

import aas_core3_2.types as aas_types

from aas_client3_2 import (
    discovery as aas_client_discovery,
    http as aas_client_http,
    requests_transport as aas_client_requests_transport,
)

server = aas_client_http.Server(
    transport=aas_client_requests_transport.RequestsTransport(
        requests.Session()
    ),
    base_url="http://localhost:5009",
)

shell_id = "https://example.com/ids/aas/getting-started/discovery"

aas_client_discovery.post_all_asset_links_by_id(
    server,
    shell_id,
    [
        aas_types.SpecificAssetID(
            name="serialNumber", value="GS-12345"
        ),
        aas_types.SpecificAssetID(name="batch", value="2026-11"),
    ],
)

Find the shells by the IDs of their assets:

page = aas_client_discovery.get_all_asset_administration_shell_ids_by_asset_link(
    server,
    asset_ids=[
        aas_types.SpecificAssetID(
            name="serialNumber", value="GS-12345"
        )
    ],
)
for found_shell_id in page.over_result_or_empty():
    print(found_shell_id)

# Prints:
# https://example.com/ids/aas/getting-started/discovery

Read the links of a shell, and remove them:

links = aas_client_discovery.get_all_asset_links_by_id(
    server, shell_id
)
for link in links:
    print(link.name, link.value)

# Prints:
# serialNumber GS-12345
# batch 2026-11

aas_client_discovery.delete_all_asset_links_by_id(server, shell_id)