aas-http-client 0.2.4__tar.gz → 0.2.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of aas-http-client might be problematic. Click here for more details.
- {aas_http_client-0.2.4 → aas_http_client-0.2.5}/PKG-INFO +3 -1
- {aas_http_client-0.2.4 → aas_http_client-0.2.5}/README.md +2 -0
- {aas_http_client-0.2.4 → aas_http_client-0.2.5}/aas_http_client/client.py +32 -27
- {aas_http_client-0.2.4 → aas_http_client-0.2.5}/aas_http_client/demo/demo_process.py +12 -10
- {aas_http_client-0.2.4 → aas_http_client-0.2.5}/aas_http_client/wrapper/sdk_wrapper.py +60 -47
- {aas_http_client-0.2.4 → aas_http_client-0.2.5}/aas_http_client.egg-info/PKG-INFO +3 -1
- {aas_http_client-0.2.4 → aas_http_client-0.2.5}/pyproject.toml +1 -1
- {aas_http_client-0.2.4 → aas_http_client-0.2.5}/LICENSE +0 -0
- {aas_http_client-0.2.4 → aas_http_client-0.2.5}/aas_http_client/__init__.py +0 -0
- {aas_http_client-0.2.4 → aas_http_client-0.2.5}/aas_http_client/core/encoder.py +0 -0
- {aas_http_client-0.2.4 → aas_http_client-0.2.5}/aas_http_client/core/version_check.py +0 -0
- {aas_http_client-0.2.4 → aas_http_client-0.2.5}/aas_http_client/demo/logging_handler.py +0 -0
- {aas_http_client-0.2.4 → aas_http_client-0.2.5}/aas_http_client/utilities/__init__.py +0 -0
- {aas_http_client-0.2.4 → aas_http_client-0.2.5}/aas_http_client/utilities/model_builder.py +0 -0
- {aas_http_client-0.2.4 → aas_http_client-0.2.5}/aas_http_client.egg-info/SOURCES.txt +0 -0
- {aas_http_client-0.2.4 → aas_http_client-0.2.5}/aas_http_client.egg-info/dependency_links.txt +0 -0
- {aas_http_client-0.2.4 → aas_http_client-0.2.5}/aas_http_client.egg-info/top_level.txt +0 -0
- {aas_http_client-0.2.4 → aas_http_client-0.2.5}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: aas-http-client
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.5
|
|
4
4
|
Summary: Generic python HTTP client for communication with various types of AAS servers
|
|
5
5
|
Author-email: Daniel Klein <daniel.klein@em.ag>
|
|
6
6
|
License: # :em engineering methods AG Software License
|
|
@@ -153,6 +153,8 @@ Wrappers are currently available for the following frameworks:
|
|
|
153
153
|
|
|
154
154
|
🤖 [Releases](http://github.com/fluid40/aas-http-client/releases)
|
|
155
155
|
|
|
156
|
+
📝 [Changelog](CHANGELOG.md)
|
|
157
|
+
|
|
156
158
|
📦 [Pypi Packages](https://pypi.org/project/aas-http-client/)
|
|
157
159
|
|
|
158
160
|
📜 [em AG Software License](LICENSE)
|
|
@@ -41,6 +41,8 @@ Wrappers are currently available for the following frameworks:
|
|
|
41
41
|
|
|
42
42
|
🤖 [Releases](http://github.com/fluid40/aas-http-client/releases)
|
|
43
43
|
|
|
44
|
+
📝 [Changelog](CHANGELOG.md)
|
|
45
|
+
|
|
44
46
|
📦 [Pypi Packages](https://pypi.org/project/aas-http-client/)
|
|
45
47
|
|
|
46
48
|
📜 [em AG Software License](LICENSE)
|
|
@@ -123,8 +123,8 @@ class AasHttpClient(BaseModel):
|
|
|
123
123
|
|
|
124
124
|
# region shells
|
|
125
125
|
|
|
126
|
-
def
|
|
127
|
-
"""
|
|
126
|
+
def post_asset_administration_shell(self, aas_data: dict) -> dict | None:
|
|
127
|
+
"""Creates a new Asset Administration Shell.
|
|
128
128
|
|
|
129
129
|
:param aas_data: Json data of the Asset Administration Shell to post
|
|
130
130
|
:return: Response data as a dictionary or None if an error occurred
|
|
@@ -147,8 +147,8 @@ class AasHttpClient(BaseModel):
|
|
|
147
147
|
content = response.content.decode("utf-8")
|
|
148
148
|
return json.loads(content)
|
|
149
149
|
|
|
150
|
-
def
|
|
151
|
-
"""
|
|
150
|
+
def put_asset_administration_shell_by_id(self, identifier: str, aas_data: dict) -> bool:
|
|
151
|
+
"""Creates or replaces an existing Asset Administration Shell.
|
|
152
152
|
|
|
153
153
|
:param identifier: Identifier of the AAS to update
|
|
154
154
|
:param aas_data: Json data of the Asset Administration Shell data to update
|
|
@@ -171,8 +171,8 @@ class AasHttpClient(BaseModel):
|
|
|
171
171
|
|
|
172
172
|
return True
|
|
173
173
|
|
|
174
|
-
def
|
|
175
|
-
"""
|
|
174
|
+
def put_submodel_by_id_aas_repository(self, aas_id: str, submodel_id: str, submodel_data: dict) -> bool:
|
|
175
|
+
"""Updates the Submodel.
|
|
176
176
|
|
|
177
177
|
:param aas_id: ID of the AAS to update the submodel for
|
|
178
178
|
:param submodel_data: Json data to the Submodel to update
|
|
@@ -196,8 +196,8 @@ class AasHttpClient(BaseModel):
|
|
|
196
196
|
|
|
197
197
|
return True
|
|
198
198
|
|
|
199
|
-
def
|
|
200
|
-
"""
|
|
199
|
+
def get_all_asset_administration_shells(self) -> list[dict] | None:
|
|
200
|
+
"""Returns all Asset Administration Shells.
|
|
201
201
|
|
|
202
202
|
:return: List of paginated Asset Administration Shells data or None if an error occurred
|
|
203
203
|
"""
|
|
@@ -218,8 +218,8 @@ class AasHttpClient(BaseModel):
|
|
|
218
218
|
content = response.content.decode("utf-8")
|
|
219
219
|
return json.loads(content)
|
|
220
220
|
|
|
221
|
-
def
|
|
222
|
-
"""
|
|
221
|
+
def get_asset_administration_shell_by_id(self, aas_id: str) -> dict | None:
|
|
222
|
+
"""Returns a specific Asset Administration Shell.
|
|
223
223
|
|
|
224
224
|
:param aas_id: ID of the AAS to retrieve
|
|
225
225
|
:return: Asset Administration Shells data or None if an error occurred
|
|
@@ -243,7 +243,12 @@ class AasHttpClient(BaseModel):
|
|
|
243
243
|
return json.loads(content)
|
|
244
244
|
|
|
245
245
|
|
|
246
|
-
def
|
|
246
|
+
def get_asset_administration_shell_by_id_reference_aas_repository(self, aas_id: str) -> Reference | None:
|
|
247
|
+
"""Returns a specific Asset Administration Shell as a Reference.
|
|
248
|
+
|
|
249
|
+
:param aas_id: ID of the AAS reference to retrieve
|
|
250
|
+
:return: Asset Administration Shells reference data or None if an error occurred
|
|
251
|
+
"""
|
|
247
252
|
decoded_aas_id: str = decode_base_64(aas_id)
|
|
248
253
|
url = f"{self.base_url}/shells/{decoded_aas_id}/$reference"
|
|
249
254
|
|
|
@@ -262,8 +267,8 @@ class AasHttpClient(BaseModel):
|
|
|
262
267
|
ref_dict_string = response.content.decode("utf-8")
|
|
263
268
|
return json.loads(ref_dict_string, cls=basyx.aas.adapter.json.AASFromJsonDecoder)
|
|
264
269
|
|
|
265
|
-
def
|
|
266
|
-
"""
|
|
270
|
+
def get_submodel_by_id_aas_repository(self, aas_id: str, submodel_id: str) -> Submodel | None:
|
|
271
|
+
"""Returns the Submodel.
|
|
267
272
|
|
|
268
273
|
:param aas_id: ID of the AAS to retrieve the submodel from
|
|
269
274
|
:param submodel_id: ID of the submodel to retrieve
|
|
@@ -290,8 +295,8 @@ class AasHttpClient(BaseModel):
|
|
|
290
295
|
content = response.content.decode("utf-8")
|
|
291
296
|
return json.loads(content)
|
|
292
297
|
|
|
293
|
-
def
|
|
294
|
-
"""
|
|
298
|
+
def delete_asset_administration_shell_by_id(self, aas_id: str) -> bool:
|
|
299
|
+
"""Deletes an Asset Administration Shell.
|
|
295
300
|
|
|
296
301
|
:param aas_id: ID of the AAS to retrieve
|
|
297
302
|
:return: True if the deletion was successful, False otherwise
|
|
@@ -317,8 +322,8 @@ class AasHttpClient(BaseModel):
|
|
|
317
322
|
|
|
318
323
|
# region submodels
|
|
319
324
|
|
|
320
|
-
def
|
|
321
|
-
"""
|
|
325
|
+
def post_submodel(self, submodel_data: dict) -> dict | None:
|
|
326
|
+
"""Creates a new Submodel.
|
|
322
327
|
|
|
323
328
|
:param Submodel_data: Json data of the Submodel to post
|
|
324
329
|
:return: Submodel data or None if an error occurred
|
|
@@ -364,8 +369,8 @@ class AasHttpClient(BaseModel):
|
|
|
364
369
|
|
|
365
370
|
return True
|
|
366
371
|
|
|
367
|
-
def
|
|
368
|
-
"""Returns all Submodels
|
|
372
|
+
def get_all_submodels(self) -> list[dict] | None:
|
|
373
|
+
"""Returns all Submodels.
|
|
369
374
|
|
|
370
375
|
:return: List of Submodel data or None if an error occurred
|
|
371
376
|
"""
|
|
@@ -386,7 +391,7 @@ class AasHttpClient(BaseModel):
|
|
|
386
391
|
content = response.content.decode("utf-8")
|
|
387
392
|
return json.loads(content)
|
|
388
393
|
|
|
389
|
-
def
|
|
394
|
+
def get_submodel_by_id(self, submodel_id: str) -> dict | None:
|
|
390
395
|
"""Returns a specific Submodel.
|
|
391
396
|
|
|
392
397
|
:param submodel_id: Encoded ID of the Submodel to retrieve
|
|
@@ -411,7 +416,7 @@ class AasHttpClient(BaseModel):
|
|
|
411
416
|
return json.loads(content)
|
|
412
417
|
|
|
413
418
|
def patch_submodel_by_id(self, submodel_id: str, submodel_data: dict) -> bool:
|
|
414
|
-
"""Updates an existing Submodel
|
|
419
|
+
"""Updates an existing Submodel.
|
|
415
420
|
|
|
416
421
|
:param submodel_id: Encoded ID of the Submodel to delete
|
|
417
422
|
:return: True if the patch was successful, False otherwise
|
|
@@ -433,8 +438,8 @@ class AasHttpClient(BaseModel):
|
|
|
433
438
|
|
|
434
439
|
return True
|
|
435
440
|
|
|
436
|
-
def
|
|
437
|
-
"""Deletes a
|
|
441
|
+
def delete_submodel_by_id(self, submodel_id: str) -> bool:
|
|
442
|
+
"""Deletes a Submodel.
|
|
438
443
|
|
|
439
444
|
:param submodel_id: Encoded ID of the Submodel to delete
|
|
440
445
|
:return: True if the deletion was successful, False otherwise
|
|
@@ -456,8 +461,8 @@ class AasHttpClient(BaseModel):
|
|
|
456
461
|
|
|
457
462
|
return True
|
|
458
463
|
|
|
459
|
-
def
|
|
460
|
-
"""Returns all
|
|
464
|
+
def get_all_submodel_elements_submodel_repository(self, submodel_id: str) -> list[dict] | None:
|
|
465
|
+
"""Returns all submodel elements including their hierarchy.
|
|
461
466
|
|
|
462
467
|
:param submodel_id: Encoded ID of the Submodel to retrieve elements from
|
|
463
468
|
:return: List of Submodel element data or None if an error occurred
|
|
@@ -480,8 +485,8 @@ class AasHttpClient(BaseModel):
|
|
|
480
485
|
content = response.content.decode("utf-8")
|
|
481
486
|
return json.loads(content)
|
|
482
487
|
|
|
483
|
-
def
|
|
484
|
-
"""
|
|
488
|
+
def post_submodel_element_submodel_repo(self, submodel_id: str, submodel_element_data: dict) -> dict | None:
|
|
489
|
+
"""Creates a new submodel element.
|
|
485
490
|
|
|
486
491
|
:param submodel_id: Encoded ID of the Submodel to create elements for
|
|
487
492
|
:return: Submodel element data or None if an error occurred
|
|
@@ -33,23 +33,25 @@ def start():
|
|
|
33
33
|
java_sdk_wrapper = _create_sdk_wrapper(Path("./aas_http_client/demo/java_server_config.json"))
|
|
34
34
|
# dotnet_sdk_wrapper = _create_sdk_wrapper(Path("./aas_http_client/demo/dotnet_server_config.json"))
|
|
35
35
|
|
|
36
|
-
for existing_shell in java_sdk_wrapper.
|
|
36
|
+
for existing_shell in java_sdk_wrapper.get_all_asset_administration_shells():
|
|
37
37
|
logger.warning(f"Delete shell '{existing_shell.id}'")
|
|
38
|
-
java_sdk_wrapper.
|
|
38
|
+
java_sdk_wrapper.delete_asset_administration_shell_by_id(existing_shell.id)
|
|
39
39
|
|
|
40
|
-
for existing_submodel in java_sdk_wrapper.
|
|
40
|
+
for existing_submodel in java_sdk_wrapper.get_all_submodels():
|
|
41
41
|
logger.warning(f"Delete submodel '{existing_submodel.id}'")
|
|
42
|
-
java_sdk_wrapper.
|
|
42
|
+
java_sdk_wrapper.delete_submodel_by_id(existing_submodel.id)
|
|
43
43
|
|
|
44
|
-
java_sdk_wrapper.
|
|
45
|
-
java_sdk_wrapper.
|
|
44
|
+
java_sdk_wrapper.post_asset_administration_shell(aas)
|
|
45
|
+
java_sdk_wrapper.post_submodel(submodel)
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
submodel = java_sdk_wrapper.get_submodels_by_id(submodel.id)
|
|
47
|
+
tmp = java_sdk_wrapper.get_asset_administration_shell_by_id_reference_aas_repository(aas.id)
|
|
49
48
|
|
|
50
|
-
java_sdk_wrapper.
|
|
49
|
+
shell = java_sdk_wrapper.get_asset_administration_shell_by_id(aas.id)
|
|
50
|
+
submodel = java_sdk_wrapper.get_submodel_by_id(submodel.id)
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
java_sdk_wrapper.post_submodel_element_submodel_repo(submodel.id, sme)
|
|
53
|
+
|
|
54
|
+
submodel = java_sdk_wrapper.get_submodel_by_id(submodel.id)
|
|
53
55
|
|
|
54
56
|
|
|
55
57
|
def _create_shell() -> basyx.aas.model.AssetAdministrationShell:
|
|
@@ -14,45 +14,46 @@ logger = logging.getLogger(__name__)
|
|
|
14
14
|
class SdkWrapper():
|
|
15
15
|
"""Represents a wrapper for the BaSyx Python SDK to communicate with a REST API."""
|
|
16
16
|
_client: AasHttpClient = None
|
|
17
|
+
base_url: str = ""
|
|
17
18
|
|
|
18
19
|
# region shells
|
|
19
20
|
|
|
20
|
-
def
|
|
21
|
-
"""
|
|
21
|
+
def post_asset_administration_shell(self, aas: model.AssetAdministrationShell) -> model.AssetAdministrationShell | None:
|
|
22
|
+
"""Creates a new Asset Administration Shell.
|
|
22
23
|
|
|
23
24
|
:param aas: Asset Administration Shell to post
|
|
24
25
|
:return: Response data as a dictionary or None if an error occurred
|
|
25
26
|
"""
|
|
26
27
|
aas_data = _to_dict(aas)
|
|
27
|
-
content: dict = self._client.
|
|
28
|
+
content: dict = self._client.post_asset_administration_shell(aas_data)
|
|
28
29
|
return _to_object(content)
|
|
29
30
|
|
|
30
|
-
def
|
|
31
|
-
"""
|
|
31
|
+
def put_asset_administration_shell_by_id(self, identifier: str, aas: model.AssetAdministrationShell) -> bool:
|
|
32
|
+
"""Creates or replaces an existing Asset Administration Shell.
|
|
32
33
|
|
|
33
34
|
:param identifier: Identifier of the AAS to update
|
|
34
35
|
:param aas: Asset Administration Shell data to update
|
|
35
36
|
:return: True if the update was successful, False otherwise
|
|
36
37
|
"""
|
|
37
38
|
aas_data = _to_dict(aas)
|
|
38
|
-
return self._client.
|
|
39
|
+
return self._client.put_asset_administration_shell_by_id(identifier, aas_data)
|
|
39
40
|
|
|
40
|
-
def
|
|
41
|
-
"""
|
|
41
|
+
def put_submodel_by_id_aas_repository(self, aas_id: str, submodel_id: str, submodel: model.Submodel) -> bool:
|
|
42
|
+
"""Updates the Submodel.
|
|
42
43
|
|
|
43
44
|
:param aas_id: ID of the AAS to update the submodel for
|
|
44
45
|
:param submodel: Submodel data to update
|
|
45
46
|
:return: True if the update was successful, False otherwise
|
|
46
47
|
"""
|
|
47
48
|
sm_data = _to_dict(submodel)
|
|
48
|
-
return self._client.
|
|
49
|
+
return self._client.put_submodel_by_id_aas_repository(aas_id, submodel_id, sm_data)
|
|
49
50
|
|
|
50
|
-
def
|
|
51
|
-
"""
|
|
51
|
+
def get_all_asset_administration_shells(self) -> list[model.AssetAdministrationShell] | None:
|
|
52
|
+
"""Returns all Asset Administration Shells.
|
|
52
53
|
|
|
53
|
-
:return:
|
|
54
|
+
:return: Asset Administration Shells objects or None if an error occurred
|
|
54
55
|
"""
|
|
55
|
-
content: dict = self._client.
|
|
56
|
+
content: dict = self._client.get_all_asset_administration_shells()
|
|
56
57
|
|
|
57
58
|
if not content:
|
|
58
59
|
return None
|
|
@@ -76,13 +77,13 @@ class SdkWrapper():
|
|
|
76
77
|
|
|
77
78
|
return aas_list
|
|
78
79
|
|
|
79
|
-
def
|
|
80
|
-
"""
|
|
81
|
-
|
|
80
|
+
def get_asset_administration_shell_by_id(self, aas_id: str) -> model.AssetAdministrationShell | None:
|
|
81
|
+
"""Returns a specific Asset Administration Shell.
|
|
82
|
+
|
|
82
83
|
:param aas_id: ID of the AAS to retrieve
|
|
83
|
-
:return:
|
|
84
|
+
:return: Asset Administration Shells object or None if an error occurred
|
|
84
85
|
"""
|
|
85
|
-
content: dict = self._client.
|
|
86
|
+
content: dict = self._client.get_asset_administration_shell_by_id(aas_id)
|
|
86
87
|
|
|
87
88
|
if not content:
|
|
88
89
|
logger.warning(f"No shell found with ID '{aas_id}' on server.")
|
|
@@ -90,48 +91,53 @@ class SdkWrapper():
|
|
|
90
91
|
|
|
91
92
|
return _to_object(content)
|
|
92
93
|
|
|
93
|
-
def
|
|
94
|
+
def get_asset_administration_shell_by_id_reference_aas_repository(self, aas_id: str) -> model.Reference | None:
|
|
95
|
+
"""Returns a specific Asset Administration Shell as a Reference.
|
|
96
|
+
|
|
97
|
+
:param aas_id: ID of the AAS reference to retrieve
|
|
98
|
+
:return: Asset Administration Shells reference object or None if an error occurred
|
|
99
|
+
"""
|
|
94
100
|
#workaround because serialization not working
|
|
95
|
-
aas = self.
|
|
101
|
+
aas = self.get_asset_administration_shell_by_id(aas_id)
|
|
96
102
|
return model.ModelReference.from_referable(aas)
|
|
97
103
|
|
|
98
104
|
# content: dict = self._client.get_shells_reference_by_id(aas_id)
|
|
99
105
|
# return json.loads(content, cls=basyx.aas.adapter.json.AASFromJsonDecoder)
|
|
100
106
|
|
|
101
|
-
def
|
|
102
|
-
"""
|
|
107
|
+
def get_submodel_by_id_aas_repository(self, aas_id: str, submodel_id: str) -> model.Submodel | None:
|
|
108
|
+
"""Returns the Submodel.
|
|
103
109
|
|
|
104
110
|
:param aas_id: ID of the AAS to retrieve the submodel from
|
|
105
111
|
:param submodel_id: ID of the submodel to retrieve
|
|
106
112
|
:return: Submodel object or None if an error occurred
|
|
107
113
|
"""
|
|
108
|
-
content: dict = self._client.
|
|
114
|
+
content: dict = self._client.get_submodel_by_id_aas_repository(aas_id, submodel_id)
|
|
109
115
|
return _to_object(content)
|
|
110
116
|
|
|
111
|
-
def
|
|
112
|
-
"""
|
|
117
|
+
def delete_asset_administration_shell_by_id(self, aas_id: str) -> bool:
|
|
118
|
+
"""Deletes an Asset Administration Shell.
|
|
113
119
|
|
|
114
120
|
:param aas_id: ID of the AAS to retrieve
|
|
115
121
|
:return: True if the deletion was successful, False otherwise
|
|
116
122
|
"""
|
|
117
|
-
return self._client.
|
|
123
|
+
return self._client.delete_asset_administration_shell_by_id(aas_id)
|
|
118
124
|
|
|
119
125
|
# endregion
|
|
120
126
|
|
|
121
127
|
# region submodels
|
|
122
128
|
|
|
123
|
-
def
|
|
124
|
-
"""
|
|
129
|
+
def post_submodel(self, submodel: model.Submodel) -> model.Submodel | None:
|
|
130
|
+
"""Creates a new Submodel.
|
|
125
131
|
|
|
126
132
|
:param submodel: submodel data as a dictionary
|
|
127
133
|
:return: Response data as a dictionary or None if an error occurred
|
|
128
134
|
"""
|
|
129
135
|
sm_data = _to_dict(submodel)
|
|
130
|
-
content: dict = self._client.
|
|
136
|
+
content: dict = self._client.post_submodel(sm_data)
|
|
131
137
|
return _to_object(content)
|
|
132
138
|
|
|
133
139
|
def put_submodels_by_id(self, identifier: str, submodel: model.Submodel) -> bool:
|
|
134
|
-
"""
|
|
140
|
+
"""Updates a existing Submodel.
|
|
135
141
|
|
|
136
142
|
:param identifier: Identifier of the submodel to update
|
|
137
143
|
:param submodel: Submodel data to update
|
|
@@ -140,12 +146,12 @@ class SdkWrapper():
|
|
|
140
146
|
sm_data = _to_dict(submodel)
|
|
141
147
|
return self._client.put_submodels_by_id(identifier, sm_data)
|
|
142
148
|
|
|
143
|
-
def
|
|
144
|
-
"""
|
|
149
|
+
def get_all_submodels(self) -> list[model.Submodel] | None:
|
|
150
|
+
"""Returns all Submodels.
|
|
145
151
|
|
|
146
152
|
:return: Submodel objects or None if an error occurred
|
|
147
153
|
"""
|
|
148
|
-
content: list = self._client.
|
|
154
|
+
content: list = self._client.get_all_submodels()
|
|
149
155
|
|
|
150
156
|
if not content:
|
|
151
157
|
return []
|
|
@@ -169,13 +175,13 @@ class SdkWrapper():
|
|
|
169
175
|
|
|
170
176
|
return submodels
|
|
171
177
|
|
|
172
|
-
def
|
|
173
|
-
"""
|
|
178
|
+
def get_submodel_by_id(self, submodel_id: str) -> model.Submodel | None:
|
|
179
|
+
"""Returns a specific Submodel.
|
|
174
180
|
|
|
175
181
|
:param submodel_id: ID of the submodel to retrieve
|
|
176
182
|
:return: Submodel object or None if an error occurred
|
|
177
183
|
"""
|
|
178
|
-
content = self._client.
|
|
184
|
+
content = self._client.get_submodel_by_id(submodel_id)
|
|
179
185
|
|
|
180
186
|
if not content:
|
|
181
187
|
logger.warning(f"No submodel found with ID '{submodel_id}' on server.")
|
|
@@ -184,25 +190,30 @@ class SdkWrapper():
|
|
|
184
190
|
return _to_object(content)
|
|
185
191
|
|
|
186
192
|
def patch_submodel_by_id(self, submodel_id: str, submodel: model.Submodel):
|
|
193
|
+
"""Updates an existing Submodel
|
|
194
|
+
|
|
195
|
+
:param submodel_id: Encoded ID of the Submodel to delete
|
|
196
|
+
:return: True if the patch was successful, False otherwise
|
|
197
|
+
"""
|
|
187
198
|
sm_data = _to_dict(submodel)
|
|
188
199
|
return self._client.patch_submodel_by_id(submodel_id, sm_data)
|
|
189
200
|
|
|
190
|
-
def
|
|
191
|
-
"""
|
|
201
|
+
def delete_submodel_by_id(self, submodel_id: str) -> bool:
|
|
202
|
+
"""Deletes a Submodel.
|
|
192
203
|
|
|
193
204
|
:param submodel_id: ID of the submodel to delete
|
|
194
205
|
:return: True if the deletion was successful, False otherwise
|
|
195
206
|
"""
|
|
196
|
-
return self._client.
|
|
207
|
+
return self._client.delete_submodel_by_id(submodel_id)
|
|
197
208
|
|
|
198
|
-
def
|
|
199
|
-
"""Returns all
|
|
209
|
+
def get_all_submodel_elements_submodel_repository(self, submodel_id: str, ) -> list[model.SubmodelElement] | None:
|
|
210
|
+
"""Returns all submodel elements including their hierarchy.
|
|
200
211
|
!!! Serialization to model.SubmodelElement currently not possible
|
|
201
212
|
|
|
202
213
|
:param submodel_id: Encoded ID of the Submodel to retrieve elements from
|
|
203
214
|
:return: List of Submodel elements or None if an error occurred
|
|
204
215
|
"""
|
|
205
|
-
content = self._client.
|
|
216
|
+
content = self._client.get_all_submodel_elements_submodel_repository(submodel_id)
|
|
206
217
|
|
|
207
218
|
if not content:
|
|
208
219
|
return []
|
|
@@ -226,8 +237,8 @@ class SdkWrapper():
|
|
|
226
237
|
|
|
227
238
|
return submodel_elements
|
|
228
239
|
|
|
229
|
-
def
|
|
230
|
-
"""
|
|
240
|
+
def post_submodel_element_submodel_repo(self, submodel_id: str, submodel_element: model.SubmodelElement) -> model.SubmodelElement | None:
|
|
241
|
+
"""Creates a new submodel element.
|
|
231
242
|
!!! Serialization to model.SubmodelElements currently not possible
|
|
232
243
|
|
|
233
244
|
:param submodel_id: Encoded ID of the submodel to create elements for
|
|
@@ -235,7 +246,7 @@ class SdkWrapper():
|
|
|
235
246
|
:return: List of submodel element objects or None if an error occurred
|
|
236
247
|
"""
|
|
237
248
|
sme_data = _to_dict(submodel_element)
|
|
238
|
-
content: dict = self._client.
|
|
249
|
+
content: dict = self._client.post_submodel_element_submodel_repo(submodel_id, sme_data)
|
|
239
250
|
return _to_object(content)
|
|
240
251
|
|
|
241
252
|
|
|
@@ -300,7 +311,8 @@ def create_wrapper_by_url(
|
|
|
300
311
|
if not client:
|
|
301
312
|
return None
|
|
302
313
|
|
|
303
|
-
wrapper._client = client
|
|
314
|
+
wrapper._client = client
|
|
315
|
+
wrapper.base_url = client.base_url
|
|
304
316
|
return wrapper
|
|
305
317
|
|
|
306
318
|
def create_wrapper_by_config(config_file: Path, password: str = "") -> SdkWrapper | None:
|
|
@@ -324,7 +336,8 @@ def create_wrapper_by_config(config_file: Path, password: str = "") -> SdkWrappe
|
|
|
324
336
|
if not client:
|
|
325
337
|
return None
|
|
326
338
|
|
|
327
|
-
wrapper._client = client
|
|
339
|
+
wrapper._client = client
|
|
340
|
+
wrapper.base_url = client.base_url
|
|
328
341
|
return wrapper
|
|
329
342
|
|
|
330
343
|
# endregion
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: aas-http-client
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.5
|
|
4
4
|
Summary: Generic python HTTP client for communication with various types of AAS servers
|
|
5
5
|
Author-email: Daniel Klein <daniel.klein@em.ag>
|
|
6
6
|
License: # :em engineering methods AG Software License
|
|
@@ -153,6 +153,8 @@ Wrappers are currently available for the following frameworks:
|
|
|
153
153
|
|
|
154
154
|
🤖 [Releases](http://github.com/fluid40/aas-http-client/releases)
|
|
155
155
|
|
|
156
|
+
📝 [Changelog](CHANGELOG.md)
|
|
157
|
+
|
|
156
158
|
📦 [Pypi Packages](https://pypi.org/project/aas-http-client/)
|
|
157
159
|
|
|
158
160
|
📜 [em AG Software License](LICENSE)
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "aas-http-client"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.5"
|
|
8
8
|
description = "Generic python HTTP client for communication with various types of AAS servers"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { file = "LICENSE" }
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{aas_http_client-0.2.4 → aas_http_client-0.2.5}/aas_http_client.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|