aas-http-client 0.4.3__py3-none-any.whl → 0.4.4__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 CHANGED
@@ -788,10 +788,10 @@ def create_client_by_url(
788
788
  """Create a HTTP client for a AAS server connection from the given parameters.
789
789
 
790
790
  :param base_url: Base URL of the AAS server, e.g. "http://basyx_python_server:80/"_
791
- :param username: Username for the AAS server, defaults to ""_
792
- :param password: Password for the AAS server, defaults to ""_
793
- :param http_proxy: http proxy URL, defaults to ""_
794
- :param https_proxy: https proxy URL, defaults to ""_
791
+ :param username: Username for the AAS server, defaults to ""
792
+ :param basic_auth_password: password for the BaSyx server basic auth, defaults to ""
793
+ :param http_proxy: http proxy URL, defaults to ""
794
+ :param https_proxy: https proxy URL, defaults to ""
795
795
  :param time_out: Timeout for the API calls, defaults to 200
796
796
  :param connection_time_out: Timeout for the connection to the API, defaults to 60
797
797
  :param ssl_verify: Whether to verify SSL certificates, defaults to True
@@ -101,7 +101,7 @@ def _create_sdk_wrapper(config: Path) -> sdk_wrapper.SdkWrapper:
101
101
  """
102
102
  try:
103
103
  file = config
104
- client = sdk_wrapper.create_wrapper_by_config(file, password="")
104
+ client = sdk_wrapper.create_wrapper_by_config(file, basic_auth_password="")
105
105
 
106
106
  except Exception as e:
107
107
  logger.error(f"Failed to create client for {file}: {e}")
@@ -19,13 +19,13 @@ class SdkWrapper:
19
19
  _client: AasHttpClient = None
20
20
  base_url: str = ""
21
21
 
22
- def __init__(self, config_string: str, password: str = ""):
22
+ def __init__(self, config_string: str, basic_auth_password: str = "", service_provider_auth_client_secret: str = ""):
23
23
  """Initializes the wrapper with the given configuration.
24
24
 
25
25
  :param config_string: Configuration string for the BaSyx server connection.
26
- :param password: Password for the BaSyx server interface client, defaults to "".
26
+ :param basic_auth_password: Password for the BaSyx server interface client, defaults to "".
27
27
  """
28
- client = _create_client(config_string, password, "")
28
+ client = _create_client(config_string, basic_auth_password, service_provider_auth_client_secret)
29
29
 
30
30
  if not client:
31
31
  raise ValueError("Failed to create AAS HTTP client with the provided configuration.")
@@ -317,8 +317,11 @@ class SdkWrapper:
317
317
 
318
318
  def create_wrapper_by_url(
319
319
  base_url: str,
320
- username: str = "",
321
- password: str = "",
320
+ basic_auth_username: str = "",
321
+ basic_auth_password: str = "",
322
+ service_provider_auth_client_id: str = "",
323
+ service_provider_auth_client_secret: str = "",
324
+ service_provider_auth_token_url: str = "",
322
325
  http_proxy: str = "",
323
326
  https_proxy: str = "",
324
327
  time_out: int = 200,
@@ -328,11 +331,11 @@ def create_wrapper_by_url(
328
331
  ) -> SdkWrapper | None:
329
332
  """Create a wrapper for a AAS server connection from the given parameters.
330
333
 
331
- :param base_url: base URL of the BaSyx server, e.g. "http://basyx_python_server:80/"_
332
- :param username: username for the BaSyx server interface client, defaults to ""_
333
- :param password: password for the BaSyx server interface client, defaults to ""_
334
- :param http_proxy: http proxy URL, defaults to ""_
335
- :param https_proxy: https proxy URL, defaults to ""_
334
+ :param base_url: base URL of the BaSyx server, e.g. "http://basyx_python_server:80/"
335
+ :param basic_auth_username: username for the BaSyx server interface client, defaults to ""
336
+ :param basic_auth_password: password for the BaSyx server basic auth, defaults to ""
337
+ :param http_proxy: http proxy URL, defaults to ""
338
+ :param https_proxy: https proxy URL, defaults to ""
336
339
  :param time_out: timeout for the API calls, defaults to 200
337
340
  :param connection_time_out: timeout for the connection to the API, defaults to 60
338
341
  :param ssl_verify: whether to verify SSL certificates, defaults to True
@@ -342,33 +345,42 @@ def create_wrapper_by_url(
342
345
  logger.info(f"Create AAS server wrapper from URL '{base_url}'.")
343
346
  config_dict: dict[str, str] = {}
344
347
  config_dict["base_url"] = base_url
345
- config_dict["username"] = username
346
348
  config_dict["http_proxy"] = http_proxy
347
349
  config_dict["https_proxy"] = https_proxy
348
350
  config_dict["time_out"] = time_out
349
351
  config_dict["connection_time_out"] = connection_time_out
350
352
  config_dict["ssl_verify"] = ssl_verify
351
353
  config_dict["trust_env"] = trust_env
352
- return create_wrapper_by_dict(config_dict, password)
353
354
 
355
+ if basic_auth_password and basic_auth_username:
356
+ config_dict["basic_auth"] = {"username": basic_auth_username}
354
357
 
355
- def create_wrapper_by_dict(configuration: dict, password: str = "") -> SdkWrapper | None:
358
+ if service_provider_auth_client_id and service_provider_auth_client_secret and service_provider_auth_token_url:
359
+ config_dict["service_provider_auth"] = {
360
+ "client_id": service_provider_auth_client_id,
361
+ "token_url": service_provider_auth_token_url,
362
+ }
363
+
364
+ return create_wrapper_by_dict(config_dict, basic_auth_password)
365
+
366
+
367
+ def create_wrapper_by_dict(configuration: dict, basic_auth_password: str = "", service_provider_auth_client_secret: str = "") -> SdkWrapper | None:
356
368
  """Create a wrapper for a AAS server connection from the given configuration.
357
369
 
358
370
  :param config: Dictionary containing the BaSyx server connection settings.
359
- :param password: Password for the BaSyx server interface client, defaults to "".
371
+ :param basic_auth_password: password for the BaSyx server basic auth, defaults to ""
360
372
  :return: An instance of SdkWrapper initialized with the provided parameters.
361
373
  """
362
374
  logger.info("Create AAS server wrapper from dictionary.")
363
375
  config_string = json.dumps(configuration, indent=4)
364
- return SdkWrapper(config_string, password)
376
+ return SdkWrapper(config_string, basic_auth_password, service_provider_auth_client_secret)
365
377
 
366
378
 
367
- def create_wrapper_by_config(config_file: Path, password: str = "") -> SdkWrapper | None:
379
+ def create_wrapper_by_config(config_file: Path, basic_auth_password: str = "", service_provider_auth_client_secret: str = "") -> SdkWrapper | None:
368
380
  """Create a wrapper for a AAS server connection from a given configuration file.
369
381
 
370
382
  :param config_file: Path to the configuration file containing the BaSyx server connection settings.
371
- :param password: password for the BaSyx server interface client, defaults to ""_
383
+ :param basic_auth_password: password for the BaSyx server basic auth, defaults to ""
372
384
  :return: An instance of SdkWrapper initialized with the provided parameters.
373
385
  """
374
386
  logger.info(f"Create AAS wrapper client from configuration file '{config_file}'.")
@@ -378,7 +390,7 @@ def create_wrapper_by_config(config_file: Path, password: str = "") -> SdkWrappe
378
390
  else:
379
391
  config_string = config_file.read_text(encoding="utf-8")
380
392
  logger.debug(f"Configuration file '{config_file}' found.")
381
- return SdkWrapper(config_string, password)
393
+ return SdkWrapper(config_string, basic_auth_password, service_provider_auth_client_secret)
382
394
 
383
395
 
384
396
  # endregion
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aas-http-client
3
- Version: 0.4.3
3
+ Version: 0.4.4
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,16 +1,16 @@
1
1
  aas_http_client/__init__.py,sha256=bBfrdXUHvukisXIj0CcnNUHUw8_7nrdnfQRve8nM_3U,982
2
- aas_http_client/client.py,sha256=KL1xT6ZIfjdz4EVZXEPrMyIgPbN622zetr_lr7gWW1k,35438
2
+ aas_http_client/client.py,sha256=wU6IhAR5F52EF7XCZokQ79cGpGEFBDl22_nalsxg5mQ,35458
3
3
  aas_http_client/classes/auth_classes.py,sha256=us1oDlBpI7R3xp2pcr9ZJ_AAaM65J-g8neq-d1M2FHw,619
4
4
  aas_http_client/core/encoder.py,sha256=FS7P0FPakzFsGz70eRFDHQZFA_2nlKLlWIxavtnFrPg,660
5
5
  aas_http_client/core/version_check.py,sha256=9dR0Q6jCFygH_ctj4vyrjerpHvolT87ayengZFlBWCw,708
6
- aas_http_client/demo/demo_process.py,sha256=WBTdiVf1CD3qHCCIFo__JE5ljL5yuCR1DibWO_NM1HA,3960
6
+ aas_http_client/demo/demo_process.py,sha256=uCyvotKWRItlhjNX7ek7ek3r5gXZ3jSARvvzcKhzyqw,3971
7
7
  aas_http_client/demo/logging_handler.py,sha256=VJtZ4u3x_LhYZQtfNck7FuXhGFZm7gid0uDhvf9GjJ8,5596
8
8
  aas_http_client/utilities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  aas_http_client/utilities/model_builder.py,sha256=SxAv8DJkKksykw_2gtTV2jHu-MRzevOVzspn807_7VA,4680
10
10
  aas_http_client/utilities/sdk_tools.py,sha256=CDD0mus8jOi-irgPO6dQHulmEyu8BSG_05Mol_nirK0,2008
11
- aas_http_client/wrapper/sdk_wrapper.py,sha256=GUftL_FiK7FMHhKifD-Y-zMSrmhd3fXysA-ycPxh_0s,15544
12
- aas_http_client-0.4.3.dist-info/licenses/LICENSE,sha256=ayt4HY-Tjoe1Uvj47j6UdNq8mEufKcKFangurChIHxQ,5990
13
- aas_http_client-0.4.3.dist-info/METADATA,sha256=aTEPdPs4Uj-Ffzny_XFuRmyCI1L70cpGEfzwfak63B0,10467
14
- aas_http_client-0.4.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
15
- aas_http_client-0.4.3.dist-info/top_level.txt,sha256=vzvoz2vjeTLwpuz-Y-eEfoQ7T3byoaKshVlFMFH5NaM,16
16
- aas_http_client-0.4.3.dist-info/RECORD,,
11
+ aas_http_client/wrapper/sdk_wrapper.py,sha256=OneN_9rtFSYUjnQWFcQneg8cih5YhkyLER4NZTAgUR0,16443
12
+ aas_http_client-0.4.4.dist-info/licenses/LICENSE,sha256=ayt4HY-Tjoe1Uvj47j6UdNq8mEufKcKFangurChIHxQ,5990
13
+ aas_http_client-0.4.4.dist-info/METADATA,sha256=Hc-PAH5vOcsBfFbI_DmubGpPfM6g1C6G85pFqeby9uM,10467
14
+ aas_http_client-0.4.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
15
+ aas_http_client-0.4.4.dist-info/top_level.txt,sha256=vzvoz2vjeTLwpuz-Y-eEfoQ7T3byoaKshVlFMFH5NaM,16
16
+ aas_http_client-0.4.4.dist-info/RECORD,,