aas-http-client 0.3.3__tar.gz → 0.4.8__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.
Files changed (26) hide show
  1. {aas_http_client-0.3.3 → aas_http_client-0.4.8}/PKG-INFO +1 -1
  2. aas_http_client-0.4.8/aas_http_client/__init__.py +31 -0
  3. aas_http_client-0.4.8/aas_http_client/classes/Configuration/config_classes.py +116 -0
  4. aas_http_client-0.3.3/aas_http_client/client.py → aas_http_client-0.4.8/aas_http_client/classes/client/aas_client.py +262 -131
  5. aas_http_client-0.4.8/aas_http_client/classes/client/implementations/authentication.py +101 -0
  6. {aas_http_client-0.3.3/aas_http_client → aas_http_client-0.4.8/aas_http_client/classes}/wrapper/sdk_wrapper.py +94 -66
  7. {aas_http_client-0.3.3 → aas_http_client-0.4.8}/aas_http_client/core/version_check.py +4 -2
  8. {aas_http_client-0.3.3 → aas_http_client-0.4.8}/aas_http_client/demo/demo_process.py +8 -41
  9. aas_http_client-0.4.8/aas_http_client/utilities/http_helper.py +56 -0
  10. {aas_http_client-0.3.3 → aas_http_client-0.4.8}/aas_http_client/utilities/model_builder.py +8 -21
  11. aas_http_client-0.4.8/aas_http_client/utilities/sdk_tools.py +58 -0
  12. {aas_http_client-0.3.3 → aas_http_client-0.4.8}/aas_http_client.egg-info/PKG-INFO +1 -1
  13. {aas_http_client-0.3.3 → aas_http_client-0.4.8}/aas_http_client.egg-info/SOURCES.txt +6 -2
  14. {aas_http_client-0.3.3 → aas_http_client-0.4.8}/pyproject.toml +1 -1
  15. {aas_http_client-0.3.3 → aas_http_client-0.4.8}/tests/test_client.py +81 -18
  16. {aas_http_client-0.3.3 → aas_http_client-0.4.8}/tests/test_wrapper.py +24 -16
  17. aas_http_client-0.3.3/aas_http_client/__init__.py +0 -22
  18. {aas_http_client-0.3.3 → aas_http_client-0.4.8}/LICENSE +0 -0
  19. {aas_http_client-0.3.3 → aas_http_client-0.4.8}/README.md +0 -0
  20. {aas_http_client-0.3.3 → aas_http_client-0.4.8}/aas_http_client/core/encoder.py +0 -0
  21. {aas_http_client-0.3.3 → aas_http_client-0.4.8}/aas_http_client/demo/logging_handler.py +0 -0
  22. {aas_http_client-0.3.3 → aas_http_client-0.4.8}/aas_http_client/utilities/__init__.py +0 -0
  23. {aas_http_client-0.3.3 → aas_http_client-0.4.8}/aas_http_client.egg-info/dependency_links.txt +0 -0
  24. {aas_http_client-0.3.3 → aas_http_client-0.4.8}/aas_http_client.egg-info/requires.txt +0 -0
  25. {aas_http_client-0.3.3 → aas_http_client-0.4.8}/aas_http_client.egg-info/top_level.txt +0 -0
  26. {aas_http_client-0.3.3 → aas_http_client-0.4.8}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aas-http-client
3
- Version: 0.3.3
3
+ Version: 0.4.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
@@ -0,0 +1,31 @@
1
+ import importlib.metadata
2
+ from datetime import datetime, timezone
3
+
4
+ __copyright__ = f"Copyright (C) {datetime.now(tz=timezone.utc).year} :em engineering methods AG. All rights reserved."
5
+ __author__ = "Daniel Klein"
6
+
7
+ try:
8
+ __version__ = importlib.metadata.version(__name__)
9
+ except importlib.metadata.PackageNotFoundError:
10
+ __version__ = "0.0.0-dev"
11
+
12
+ __project__ = "aas-http-client"
13
+ __package__ = "aas-http-client"
14
+
15
+ from aas_http_client.classes.client.aas_client import AasHttpClient, create_client_by_config, create_client_by_url
16
+ from aas_http_client.classes.wrapper.sdk_wrapper import SdkWrapper, create_wrapper_by_config, create_wrapper_by_url
17
+ from aas_http_client.core.version_check import check_for_update
18
+ from aas_http_client.utilities import model_builder, sdk_tools
19
+
20
+ check_for_update()
21
+
22
+ __all__ = [
23
+ "create_client_by_config",
24
+ "create_client_by_url",
25
+ "AasHttpClient",
26
+ "model_builder",
27
+ "create_wrapper_by_config",
28
+ "create_wrapper_by_url",
29
+ "SdkWrapper",
30
+ "sdk_tools",
31
+ ]
@@ -0,0 +1,116 @@
1
+ """Basic Authentication Configuration."""
2
+
3
+ from pydantic import BaseModel, Field, PrivateAttr
4
+
5
+
6
+ class BearerAuth(BaseModel):
7
+ """Bearer Authentication Configuration.
8
+
9
+ :param BaseModel: Pydantic BaseModel for data validation.
10
+ """
11
+
12
+ _token: str = PrivateAttr(default="")
13
+
14
+ def set_token(self, token: str) -> None:
15
+ """Set the bearer token for the authentication.
16
+
17
+ :param token: Bearer token for the authentication.
18
+ """
19
+ self._token = token
20
+
21
+ def get_token(self) -> str:
22
+ """Get the bearer token for the authentication.
23
+
24
+ :return: The bearer token.
25
+ """
26
+ return self._token
27
+
28
+ def is_active(self) -> bool:
29
+ """Check if the bearer authentication is active.
30
+
31
+ :return: True if the token is not empty, False otherwise.
32
+ """
33
+ return bool(self._token)
34
+
35
+
36
+ class BasicAuth(BaseModel):
37
+ """Basic Authentication Configuration.
38
+
39
+ :param BaseModel: Pydantic BaseModel for data validation.
40
+ """
41
+
42
+ username: str = Field(default="", alias="Username", description="Username for the basic authentication.")
43
+ _password: str = PrivateAttr(default="")
44
+
45
+ def is_active(self) -> bool:
46
+ """Check if the basic authentication is active.
47
+
48
+ :return: True if the username is not empty, False otherwise.
49
+ """
50
+ return bool(self.username and self._password)
51
+
52
+ def set_password(self, password: str) -> None:
53
+ """Set the password for the basic authentication.
54
+
55
+ :param password: Password for the basic authentication.
56
+ """
57
+ self._password = password
58
+
59
+ def get_password(self) -> str:
60
+ """Get the password for the basic authentication.
61
+
62
+ :return: The password.
63
+ """
64
+ return self._password
65
+
66
+
67
+ class OAuth(BaseModel):
68
+ """Open Authentication Configuration.
69
+
70
+ :param BaseModel: Pydantic BaseModel for data validation.
71
+ """
72
+
73
+ token_url: str = Field(default="", alias="TokenUrl", description="Endpoint URL for the token request.")
74
+ client_id: str = Field(default="", alias="ClientId", description="Client identifier for authentication.")
75
+ grant_type: str = Field(default="client_credentials", alias="GrantType", description="Grant type for the authentication.")
76
+ header_name: str = Field(default="Authorization", alias="HeaderName", description="Header name for the authentication.")
77
+ _client_secret: str = PrivateAttr(default="")
78
+
79
+ def is_active(self) -> bool:
80
+ """Check if the service provider authentication is active.
81
+
82
+ :return: True if the client ID is not empty, False otherwise.
83
+ """
84
+ return bool(self.client_id and self._client_secret and self.token_url)
85
+
86
+ def set_client_secret(self, client_secret: str) -> None:
87
+ """Set the client secret for the authentication.
88
+
89
+ :param client_secret: Client secret for the authentication.
90
+ """
91
+ self._client_secret = client_secret
92
+
93
+ def get_client_secret(self) -> str:
94
+ """Get the client secret for the authentication.
95
+
96
+ :return: The client secret.
97
+ """
98
+ if self._client_secret is None:
99
+ return ""
100
+
101
+ return self._client_secret
102
+
103
+
104
+ class AuthenticationConfig(BaseModel):
105
+ """Authentication Configuration.
106
+
107
+ param BaseModel: Pydantic BaseModel for data validation.
108
+ """
109
+
110
+ basic_auth: BasicAuth = Field(default_factory=BasicAuth, alias="BasicAuth", description="Basic authentication configuration.")
111
+ o_auth: OAuth = Field(
112
+ default_factory=OAuth,
113
+ alias="OAuth",
114
+ description="Service provider authentication configuration.",
115
+ )
116
+ bearer_auth: BearerAuth = Field(default_factory=BearerAuth, alias="BearerAuth", description="Bearer authentication configuration.")