aas-http-client 0.1.91__py3-none-any.whl → 0.2.0__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.

@@ -6,7 +6,7 @@ from pathlib import Path
6
6
 
7
7
  import basyx.aas.adapter.json
8
8
 
9
- from basyx.aas.model import AssetAdministrationShell, Reference, Submodel
9
+ from basyx.aas.model import AssetAdministrationShell, Reference, Submodel, ModelReference
10
10
  from aas_http_client.client import AasHttpClient, _create_client
11
11
  logger = logging.getLogger(__name__)
12
12
 
@@ -37,7 +37,7 @@ class SdkWrapper():
37
37
 
38
38
  return self._client.put_shells(identifier, aas_data)
39
39
 
40
- def put_shells_submodels(self, aas_id: str, submodel_id: str, submodel: Submodel) -> bool:
40
+ def put_shells_submodels_by_id(self, aas_id: str, submodel_id: str, submodel: Submodel) -> bool:
41
41
  """Update a submodel by its ID for a specific Asset Administration Shell (AAS).
42
42
 
43
43
  :param aas_id: ID of the AAS to update the submodel for
@@ -85,11 +85,16 @@ class SdkWrapper():
85
85
  :return: AAS object or None if an error occurred
86
86
  """
87
87
  content: dict = self._client.get_shells_by_id(aas_id)
88
- return json.load(content, cls=basyx.aas.adapter.json.AASFromJsonDecoder)
88
+ aas_dict_string = json.dumps(content)
89
+ return json.loads(aas_dict_string, cls=basyx.aas.adapter.json.AASFromJsonDecoder)
89
90
 
90
91
  def get_shells_reference_by_id(self, aas_id: str) -> Reference | None:
91
- content: dict = self._client.get_shells_reference_by_id(aas_id)
92
- return json.load(content, cls=basyx.aas.adapter.json.AASFromJsonDecoder)
92
+ #workaround because serialization not working
93
+ aas = self.get_shells_by_id(aas_id)
94
+ return ModelReference.from_referable(aas)
95
+
96
+ # content: dict = self._client.get_shells_reference_by_id(aas_id)
97
+ # return json.loads(content, cls=basyx.aas.adapter.json.AASFromJsonDecoder)
93
98
 
94
99
  def get_shells_submodels_by_id(self, aas_id: str, submodel_id: str) -> Submodel | None:
95
100
  """Get a submodel by its ID for a specific Asset Administration Shell (AAS).
@@ -99,7 +104,8 @@ class SdkWrapper():
99
104
  :return: Submodel object or None if an error occurred
100
105
  """
101
106
  content: dict = self._client.get_shells_submodels_by_id(aas_id, submodel_id)
102
- return json.load(content, cls=basyx.aas.adapter.json.AASFromJsonDecoder)
107
+ sm_dict_string = json.dumps(content)
108
+ return json.loads(sm_dict_string, cls=basyx.aas.adapter.json.AASFromJsonDecoder)
103
109
 
104
110
  def delete_shells_by_id(self, aas_id: str) -> bool:
105
111
  """Get an Asset Administration Shell (AAS) by its ID from the REST API.
@@ -176,8 +182,9 @@ class SdkWrapper():
176
182
  if not isinstance(content, dict):
177
183
  logger.error(f"Invalid submodel data: {content}")
178
184
  return None
179
- #
180
- return json.loads(content, cls=basyx.aas.adapter.json.AASFromJsonDecoder)
185
+
186
+ sm_dict_string = json.dumps(content)
187
+ return json.loads(sm_dict_string, cls=basyx.aas.adapter.json.AASFromJsonDecoder)
181
188
 
182
189
  def patch_submodel_by_id(self, submodel_id: str, submodel: Submodel):
183
190
  sm_dict_string = json.dumps(submodel, cls=basyx.aas.adapter.json.AASToJsonEncoder)
@@ -248,5 +255,10 @@ def create_wrapper_by_config(config_file: Path, password: str = "") -> AasHttpCl
248
255
  logger.debug(f"Server config file '{config_file}' found.")
249
256
 
250
257
  wrapper = SdkWrapper()
251
- wrapper._client = _create_client(config_string, password)
258
+ client = _create_client(config_string, password)
259
+
260
+ if not client:
261
+ return None
262
+
263
+ wrapper._client = _create_client(config_string, password)
252
264
  return wrapper
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aas-http-client
3
- Version: 0.1.91
3
+ Version: 0.2.0
4
4
  Summary: Generic HTTP client for communicating 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
@@ -6,9 +6,9 @@ aas_http_client/demo/demo_process.py,sha256=-9-oQEi_B08W-POl2SVP4COodGPHN3mTw9rr
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=bL4hy3uHh1Y_uL6KmLIfo9ORiUqWNlyToJrAt8G1rpw,3877
9
- aas_http_client/wrapper/sdk_wrapper.py,sha256=O61Q32zlWxsNqpb4p811GbPd2Un9VGLY_pXR5Q-0QTg,10395
10
- aas_http_client-0.1.91.dist-info/licenses/LICENSE,sha256=ayt4HY-Tjoe1Uvj47j6UdNq8mEufKcKFangurChIHxQ,5990
11
- aas_http_client-0.1.91.dist-info/METADATA,sha256=X8CH-88IlO_ZZyatIOqYZJ38AdO042bZ5XMmfAkFFxg,8913
12
- aas_http_client-0.1.91.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
13
- aas_http_client-0.1.91.dist-info/top_level.txt,sha256=vzvoz2vjeTLwpuz-Y-eEfoQ7T3byoaKshVlFMFH5NaM,16
14
- aas_http_client-0.1.91.dist-info/RECORD,,
9
+ aas_http_client/wrapper/sdk_wrapper.py,sha256=Zgk1khEAePU9nKKmFbe-GWm6hsUplBQ9kLJHcFRcbjU,10828
10
+ aas_http_client-0.2.0.dist-info/licenses/LICENSE,sha256=ayt4HY-Tjoe1Uvj47j6UdNq8mEufKcKFangurChIHxQ,5990
11
+ aas_http_client-0.2.0.dist-info/METADATA,sha256=waYKaIXICM72kDFG-OirJRq53hD0_9tCPnkOdSGl57s,8912
12
+ aas_http_client-0.2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
13
+ aas_http_client-0.2.0.dist-info/top_level.txt,sha256=vzvoz2vjeTLwpuz-Y-eEfoQ7T3byoaKshVlFMFH5NaM,16
14
+ aas_http_client-0.2.0.dist-info/RECORD,,