aas-http-client 0.4.1__py3-none-any.whl → 0.4.2__py3-none-any.whl
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/client.py +26 -0
- aas_http_client/wrapper/sdk_wrapper.py +15 -1
- {aas_http_client-0.4.1.dist-info → aas_http_client-0.4.2.dist-info}/METADATA +1 -1
- {aas_http_client-0.4.1.dist-info → aas_http_client-0.4.2.dist-info}/RECORD +7 -7
- {aas_http_client-0.4.1.dist-info → aas_http_client-0.4.2.dist-info}/WHEEL +0 -0
- {aas_http_client-0.4.1.dist-info → aas_http_client-0.4.2.dist-info}/licenses/LICENSE +0 -0
- {aas_http_client-0.4.1.dist-info → aas_http_client-0.4.2.dist-info}/top_level.txt +0 -0
aas_http_client/client.py
CHANGED
|
@@ -510,6 +510,32 @@ class AasHttpClient(BaseModel):
|
|
|
510
510
|
content = response.content.decode("utf-8")
|
|
511
511
|
return json.loads(content)
|
|
512
512
|
|
|
513
|
+
def post_submodel_element_by_path_submodel_repo(self, submodel_id: str, submodel_element_path: str, submodel_element_data: dict) -> dict | None:
|
|
514
|
+
"""Creates a new submodel element at a specified path within submodel elements hierarchy.
|
|
515
|
+
|
|
516
|
+
:param submodel_id: Encoded ID of the Submodel to create elements for
|
|
517
|
+
:param submodel_element_path: Path within the Submodel elements hierarchy
|
|
518
|
+
:param submodel_element_data: Data for the new Submodel element
|
|
519
|
+
:return: Submodel element data or None if an error occurred
|
|
520
|
+
"""
|
|
521
|
+
decoded_submodel_id: str = decode_base_64(submodel_id)
|
|
522
|
+
url = f"{self.base_url}/submodels/{decoded_submodel_id}/submodel-elements/{submodel_element_path}"
|
|
523
|
+
|
|
524
|
+
try:
|
|
525
|
+
response = self._session.post(url, headers=HEADERS, json=submodel_element_data, timeout=self.time_out)
|
|
526
|
+
logger.debug(f"Call REST API url '{response.url}'")
|
|
527
|
+
|
|
528
|
+
if response.status_code != STATUS_CODE_201:
|
|
529
|
+
log_response_errors(response)
|
|
530
|
+
return None
|
|
531
|
+
|
|
532
|
+
except requests.exceptions.RequestException as e:
|
|
533
|
+
logger.error(f"Error call REST API: {e}")
|
|
534
|
+
return None
|
|
535
|
+
|
|
536
|
+
content = response.content.decode("utf-8")
|
|
537
|
+
return json.loads(content)
|
|
538
|
+
|
|
513
539
|
def get_submodel_element_by_path_submodel_repo(self, submodel_id: str, submodel_element_path: str) -> dict | None:
|
|
514
540
|
"""Returns a specific submodel element from the Submodel at a specified path.
|
|
515
541
|
|
|
@@ -257,7 +257,7 @@ class SdkWrapper:
|
|
|
257
257
|
return submodel_elements
|
|
258
258
|
|
|
259
259
|
def post_submodel_element_submodel_repo(self, submodel_id: str, submodel_element: model.SubmodelElement) -> model.SubmodelElement | None:
|
|
260
|
-
"""Creates a new submodel element.
|
|
260
|
+
"""Creates a new submodel element.
|
|
261
261
|
|
|
262
262
|
:param submodel_id: Encoded ID of the submodel to create elements for
|
|
263
263
|
:param submodel_element: Submodel element to create
|
|
@@ -267,6 +267,20 @@ class SdkWrapper:
|
|
|
267
267
|
content: dict = self._client.post_submodel_element_submodel_repo(submodel_id, sme_data)
|
|
268
268
|
return _to_object(content)
|
|
269
269
|
|
|
270
|
+
def post_submodel_element_by_path_submodel_repo(
|
|
271
|
+
self, submodel_id: str, submodel_element_path: str, submodel_element: model.SubmodelElement
|
|
272
|
+
) -> model.SubmodelElement | None:
|
|
273
|
+
"""Creates a new submodel element at a specified path within submodel elements hierarchy.
|
|
274
|
+
|
|
275
|
+
:param submodel_id: Encoded ID of the submodel to create elements for
|
|
276
|
+
:param submodel_element_path: Path within the Submodel elements hierarchy
|
|
277
|
+
:param submodel_element: The new Submodel element
|
|
278
|
+
:return: Submodel element object or None if an error occurred
|
|
279
|
+
"""
|
|
280
|
+
sme_data = _to_dict(submodel_element)
|
|
281
|
+
content: dict = self._client.post_submodel_element_by_path_submodel_repo(submodel_id, submodel_element_path, sme_data)
|
|
282
|
+
return _to_object(content)
|
|
283
|
+
|
|
270
284
|
def get_submodel_element_by_path_submodel_repo(self, submodel_id: str, submodel_element_path: str) -> model.SubmodelElement | None:
|
|
271
285
|
"""Returns a specific submodel element from the Submodel at a specified path.
|
|
272
286
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: aas-http-client
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.2
|
|
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
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
aas_http_client/__init__.py,sha256=bBfrdXUHvukisXIj0CcnNUHUw8_7nrdnfQRve8nM_3U,982
|
|
2
|
-
aas_http_client/client.py,sha256=
|
|
2
|
+
aas_http_client/client.py,sha256=mWM1cfynFii0eZFrfSK4w10BXFemU2_aOwgdE0iCYo0,28484
|
|
3
3
|
aas_http_client/core/encoder.py,sha256=FS7P0FPakzFsGz70eRFDHQZFA_2nlKLlWIxavtnFrPg,660
|
|
4
4
|
aas_http_client/core/version_check.py,sha256=9dR0Q6jCFygH_ctj4vyrjerpHvolT87ayengZFlBWCw,708
|
|
5
5
|
aas_http_client/demo/demo_process.py,sha256=KkYMLdQYmGdAVfIwd1f8Zn0NqOTQUrvSLXJDjGGAz5M,3369
|
|
@@ -7,9 +7,9 @@ aas_http_client/demo/logging_handler.py,sha256=VJtZ4u3x_LhYZQtfNck7FuXhGFZm7gid0
|
|
|
7
7
|
aas_http_client/utilities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
8
|
aas_http_client/utilities/model_builder.py,sha256=SxAv8DJkKksykw_2gtTV2jHu-MRzevOVzspn807_7VA,4680
|
|
9
9
|
aas_http_client/utilities/sdk_tools.py,sha256=CDD0mus8jOi-irgPO6dQHulmEyu8BSG_05Mol_nirK0,2008
|
|
10
|
-
aas_http_client/wrapper/sdk_wrapper.py,sha256=
|
|
11
|
-
aas_http_client-0.4.
|
|
12
|
-
aas_http_client-0.4.
|
|
13
|
-
aas_http_client-0.4.
|
|
14
|
-
aas_http_client-0.4.
|
|
15
|
-
aas_http_client-0.4.
|
|
10
|
+
aas_http_client/wrapper/sdk_wrapper.py,sha256=FaftHLQ97HvxNUtFO_1JizSgWbu_rsfegaMkUMWgS6c,15540
|
|
11
|
+
aas_http_client-0.4.2.dist-info/licenses/LICENSE,sha256=ayt4HY-Tjoe1Uvj47j6UdNq8mEufKcKFangurChIHxQ,5990
|
|
12
|
+
aas_http_client-0.4.2.dist-info/METADATA,sha256=Rp_HjtoKXohEC71BBe7FGhO-QHfNki-YtkisCR5PvPY,10467
|
|
13
|
+
aas_http_client-0.4.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
14
|
+
aas_http_client-0.4.2.dist-info/top_level.txt,sha256=vzvoz2vjeTLwpuz-Y-eEfoQ7T3byoaKshVlFMFH5NaM,16
|
|
15
|
+
aas_http_client-0.4.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|