aas-http-client 0.2.7__py3-none-any.whl → 0.2.8__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 +11 -0
- {aas_http_client-0.2.7.dist-info → aas_http_client-0.2.8.dist-info}/METADATA +1 -1
- {aas_http_client-0.2.7.dist-info → aas_http_client-0.2.8.dist-info}/RECORD +7 -7
- {aas_http_client-0.2.7.dist-info → aas_http_client-0.2.8.dist-info}/WHEEL +0 -0
- {aas_http_client-0.2.7.dist-info → aas_http_client-0.2.8.dist-info}/licenses/LICENSE +0 -0
- {aas_http_client-0.2.7.dist-info → aas_http_client-0.2.8.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 get_submodel_element_by_path_submodel_repo(self, submodel_id: str, submodel_element_path: str) -> dict | None:
|
|
514
|
+
"""Returns a specific submodel element from the Submodel at a specified path.
|
|
515
|
+
|
|
516
|
+
:param submodel_id: Encoded ID of the Submodel to retrieve element from
|
|
517
|
+
:param submodel_element_path: Path of the Submodel element to retrieve
|
|
518
|
+
:return: Submodel element data or None if an error occurred
|
|
519
|
+
"""
|
|
520
|
+
decoded_submodel_id: str = decode_base_64(submodel_id)
|
|
521
|
+
|
|
522
|
+
url = f"{self.base_url}/submodels/{decoded_submodel_id}/submodel-elements/{submodel_element_path}"
|
|
523
|
+
|
|
524
|
+
try:
|
|
525
|
+
response = self._session.get(url, headers=HEADERS, timeout=self.time_out)
|
|
526
|
+
logger.debug(f"Call REST API url '{response.url}'")
|
|
527
|
+
|
|
528
|
+
if response.status_code != STATUS_CODE_200:
|
|
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
|
|
|
514
540
|
# endregion
|
|
515
541
|
|
|
@@ -253,6 +253,16 @@ class SdkWrapper:
|
|
|
253
253
|
content: dict = self._client.post_submodel_element_submodel_repo(submodel_id, sme_data)
|
|
254
254
|
return _to_object(content)
|
|
255
255
|
|
|
256
|
+
def get_submodel_element_by_path_submodel_repo(self, submodel_id: str, submodel_element_path: str) -> model.SubmodelElement | None:
|
|
257
|
+
"""Returns a specific submodel element from the Submodel at a specified path.
|
|
258
|
+
|
|
259
|
+
:param submodel_id: Encoded ID of the Submodel to retrieve element from
|
|
260
|
+
:param submodel_element_path: Path of the Submodel element to retrieve
|
|
261
|
+
:return: Submodel element object or None if an error occurred
|
|
262
|
+
"""
|
|
263
|
+
content: dict = self._client.get_submodel_element_by_path_submodel_repo(submodel_id, submodel_element_path)
|
|
264
|
+
return _to_object(content)
|
|
265
|
+
|
|
256
266
|
|
|
257
267
|
# endregion
|
|
258
268
|
|
|
@@ -260,6 +270,7 @@ class SdkWrapper:
|
|
|
260
270
|
def _to_object(content: dict) -> Any | None:
|
|
261
271
|
try:
|
|
262
272
|
dict_string = json.dumps(content)
|
|
273
|
+
print(dict_string)
|
|
263
274
|
return json.loads(dict_string, cls=basyx.aas.adapter.json.AASFromJsonDecoder)
|
|
264
275
|
except Exception as e:
|
|
265
276
|
logger.error(f"Decoding error: {e}")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: aas-http-client
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.8
|
|
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,14 +1,14 @@
|
|
|
1
1
|
aas_http_client/__init__.py,sha256=cAr1mQzWp0G0LKtkAOYzc9t95OY3jM3Aj4bKnxx0Dso,901
|
|
2
|
-
aas_http_client/client.py,sha256=
|
|
2
|
+
aas_http_client/client.py,sha256=1wsVZq9cOM01fA7qNcie_NNosoeCkE_fTKNV69Rc0vM,24267
|
|
3
3
|
aas_http_client/core/encoder.py,sha256=FS7P0FPakzFsGz70eRFDHQZFA_2nlKLlWIxavtnFrPg,660
|
|
4
4
|
aas_http_client/core/version_check.py,sha256=721Zs3xSRrJTYZtAxkaUWg9LLKtpU7oFM62DzQHZdE4,705
|
|
5
5
|
aas_http_client/demo/demo_process.py,sha256=6sN_N3QbA4iLUmzeg1Y_XOwVAuDNtwkR4grAg7EkjWM,3301
|
|
6
6
|
aas_http_client/demo/logging_handler.py,sha256=VJtZ4u3x_LhYZQtfNck7FuXhGFZm7gid0uDhvf9GjJ8,5596
|
|
7
7
|
aas_http_client/utilities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
8
|
aas_http_client/utilities/model_builder.py,sha256=EUqVvKgXiyJNtyUeFrL6ronfF4hiF1KCipxSaLj6EiE,4465
|
|
9
|
-
aas_http_client/wrapper/sdk_wrapper.py,sha256=
|
|
10
|
-
aas_http_client-0.2.
|
|
11
|
-
aas_http_client-0.2.
|
|
12
|
-
aas_http_client-0.2.
|
|
13
|
-
aas_http_client-0.2.
|
|
14
|
-
aas_http_client-0.2.
|
|
9
|
+
aas_http_client/wrapper/sdk_wrapper.py,sha256=siK73pRY8Hji_aGUxrRULli_2dH48Z6skgLqH8ujxPg,13539
|
|
10
|
+
aas_http_client-0.2.8.dist-info/licenses/LICENSE,sha256=ayt4HY-Tjoe1Uvj47j6UdNq8mEufKcKFangurChIHxQ,5990
|
|
11
|
+
aas_http_client-0.2.8.dist-info/METADATA,sha256=mfnLMhi9z8Z511NwnP7kWiX6Mt0dM7MnXxQ20pySLck,10333
|
|
12
|
+
aas_http_client-0.2.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
13
|
+
aas_http_client-0.2.8.dist-info/top_level.txt,sha256=vzvoz2vjeTLwpuz-Y-eEfoQ7T3byoaKshVlFMFH5NaM,16
|
|
14
|
+
aas_http_client-0.2.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|