AAS HTTP Client Documentation
Loading...
Searching...
No Matches
aas_client.AasHttpClient Class Reference

Represents a AasHttpClient to communicate with a REST API. More...

Inheritance diagram for aas_client.AasHttpClient:
[legend]
Collaboration diagram for aas_client.AasHttpClient:
[legend]

Public Member Functions

 initialize (self)
 Initialize the AasHttpClient with the given URL, username and password.
 
 set_log_intensity (self, LogIntensity intensity)
 Set the log intensity level for the client.
 
LogIntensity get_log_intensity (self)
 Get the log intensity level for the client.
 
AuthMethod get_auth_method (self)
 Get the authentication method used by the client.
 
Session|None get_session (self)
 Get the HTTP session used by the client.
 
dict|None get_root (self)
 Get the root endpoint of the AAS server API to test connectivity.
 
str|None set_token (self)
 Set authentication token in session headers based on configured authentication method.
 
None|dict get_endpoint (self, str end_point_url)
 Generic GET request for endpoint.
 
None|dict put_endpoint (self, str end_point_url, dict request_body)
 Generic PUT request for endpoint.
 
None|dict post_endpoint (self, str end_point_url, dict request_body)
 Generic POST request for endpoint.
 
None|dict patch_endpoint (self, str end_point_url, dict request_body)
 Generic PATCH request for endpoint.
 
None|dict delete_endpoint (self, str end_point_url)
 Generic DELETE request for endpoint.
 

Public Attributes

 base_url
 
 shells
 
 submodels
 
 shell_registry
 
 submodel_registry
 
 experimental
 

Static Public Attributes

 model_config = ConfigDict(populate_by_name=True, arbitrary_types_allowed=True)
 
str base_url = Field(..., alias="BaseUrl", description="Base URL of the AAS server.")
 
AuthenticationConfig auth_settings
 
str https_proxy = Field(default=None, alias="HttpsProxy", description="HTTPS proxy URL.")
 
str http_proxy = Field(default=None, alias="HttpProxy", description="HTTP proxy URL.")
 
int time_out = Field(default=200, alias="TimeOut", description="Timeout for HTTP requests.")
 
int connection_time_out = Field(default=100, alias="ConnectionTimeOut", description="Connection timeout for HTTP requests.")
 
bool ssl_verify = Field(default=True, alias="SslVerify", description="Enable SSL verification.")
 
bool trust_env = Field(default=True, alias="TrustEnv", description="Trust environment variables.")
 
bool encoded_ids = Field(default=True, alias="EncodedIds", description="If enabled, all IDs used in API requests have to be base64-encoded.")
 
ShellRepoImplementation shells = Field(default=None)
 
SubmodelRepoImplementation submodels = Field(default=None)
 
ShellRegistryImplementation shell_registry = Field(default=None)
 
ExperimentalImplementation experimental = Field(default=None)
 
SubmodelRegistryImplementation submodel_registry = Field(default=None)
 

Protected Member Functions

 _handle_auth_method (self)
 Handles the authentication method based on the provided settings.
 

Protected Attributes

 _session
 
 _log_intensity
 
 _auth_method
 
 _cached_token
 

Static Protected Attributes

Session _session = PrivateAttr(default=None)
 
AuthMethod _auth_method = PrivateAttr(default=AuthMethod.basic_auth)
 
TokenData _cached_token = PrivateAttr(default=None)
 
LogIntensity _log_intensity = PrivateAttr(default=LogIntensity.HIGH)
 

Detailed Description

Represents a AasHttpClient to communicate with a REST API.

Definition at line 59 of file aas_client.py.

Member Function Documentation

◆ _handle_auth_method()

aas_client.AasHttpClient._handle_auth_method (   self)
protected

Handles the authentication method based on the provided settings.

Definition at line 146 of file aas_client.py.

◆ delete_endpoint()

None | dict aas_client.AasHttpClient.delete_endpoint (   self,
str  end_point_url 
)

Generic DELETE request for endpoint.

Parameters
end_point_urlThe endpoint URL to send the DELETE request to.
Returns
The base URL of the AAS server.

Definition at line 337 of file aas_client.py.

◆ get_auth_method()

AuthMethod aas_client.AasHttpClient.get_auth_method (   self)

Get the authentication method used by the client.

Returns
The authentication method used by the client

Definition at line 133 of file aas_client.py.

◆ get_endpoint()

None | dict aas_client.AasHttpClient.get_endpoint (   self,
str  end_point_url 
)

Generic GET request for endpoint.

Parameters
end_point_urlThe endpoint URL to send the GET request to.
Returns
The base URL of the AAS server.

Definition at line 242 of file aas_client.py.

◆ get_log_intensity()

LogIntensity aas_client.AasHttpClient.get_log_intensity (   self)

Get the log intensity level for the client.

Returns
The current LogIntensity level (Standard or High)

Definition at line 126 of file aas_client.py.

◆ get_root()

dict | None aas_client.AasHttpClient.get_root (   self)

Get the root endpoint of the AAS server API to test connectivity.

   This method calls the '/shells' endpoint to verify that the AAS server is accessible
   and responding. It automatically handles authentication token setup if service
   provider authentication is configured.
Returns
Response data as a dictionary containing shell information, or None if an error occurred

Definition at line 175 of file aas_client.py.

Here is the call graph for this function:

◆ get_session()

Session | None aas_client.AasHttpClient.get_session (   self)

Get the HTTP session used by the client.

Returns
The requests.Session object used for HTTP communication

Definition at line 140 of file aas_client.py.

◆ initialize()

aas_client.AasHttpClient.initialize (   self)

Initialize the AasHttpClient with the given URL, username and password.

Definition at line 85 of file aas_client.py.

◆ patch_endpoint()

None | dict aas_client.AasHttpClient.patch_endpoint (   self,
str  end_point_url,
dict  request_body 
)

Generic PATCH request for endpoint.

Parameters
end_point_urlThe endpoint URL to send the PATCH request to.
request_bodyThe request body to send with the PATCH request.
Returns
The base URL of the AAS server.

Definition at line 314 of file aas_client.py.

◆ post_endpoint()

None | dict aas_client.AasHttpClient.post_endpoint (   self,
str  end_point_url,
dict  request_body 
)

Generic POST request for endpoint.

Parameters
end_point_urlThe endpoint URL to send the POST request to.
request_bodyThe request body to send with the POST request.
Returns
The base URL of the AAS server.

Definition at line 290 of file aas_client.py.

◆ put_endpoint()

None | dict aas_client.AasHttpClient.put_endpoint (   self,
str  end_point_url,
dict  request_body 
)

Generic PUT request for endpoint.

Parameters
end_point_urlThe endpoint URL to send the PUT request to.
request_bodyThe request body to send with the PUT request.
Returns
The base URL of the AAS server.

Definition at line 266 of file aas_client.py.

◆ set_log_intensity()

aas_client.AasHttpClient.set_log_intensity (   self,
LogIntensity  intensity 
)

Set the log intensity level for the client.

Parameters
intensityLogIntensity level to set (Standard or High)

Definition at line 119 of file aas_client.py.

◆ set_token()

str | None aas_client.AasHttpClient.set_token (   self)

Set authentication token in session headers based on configured authentication method.

Returns
The access token if set, otherwise None

Definition at line 212 of file aas_client.py.

Here is the caller graph for this function:

Member Data Documentation

◆ _auth_method [1/2]

AuthMethod aas_client.AasHttpClient._auth_method = PrivateAttr(default=AuthMethod.basic_auth)
staticprotected

Definition at line 74 of file aas_client.py.

◆ _auth_method [2/2]

aas_client.AasHttpClient._auth_method
protected

Definition at line 148 of file aas_client.py.

◆ _cached_token [1/2]

TokenData aas_client.AasHttpClient._cached_token = PrivateAttr(default=None)
staticprotected

Definition at line 81 of file aas_client.py.

◆ _cached_token [2/2]

aas_client.AasHttpClient._cached_token
protected

Definition at line 230 of file aas_client.py.

◆ _log_intensity [1/2]

LogIntensity aas_client.AasHttpClient._log_intensity = PrivateAttr(default=LogIntensity.HIGH)
staticprotected

Definition at line 82 of file aas_client.py.

◆ _log_intensity [2/2]

aas_client.AasHttpClient._log_intensity
protected

Definition at line 120 of file aas_client.py.

◆ _session [1/2]

Session aas_client.AasHttpClient._session = PrivateAttr(default=None)
staticprotected

Definition at line 73 of file aas_client.py.

◆ _session [2/2]

aas_client.AasHttpClient._session
protected

Definition at line 89 of file aas_client.py.

◆ auth_settings

AuthenticationConfig aas_client.AasHttpClient.auth_settings
static
Initial value:
= Field(
default_factory=AuthenticationConfig, alias="AuthenticationSettings", description="Authentication settings for the AAS server."
)

Definition at line 64 of file aas_client.py.

◆ base_url [1/2]

str aas_client.AasHttpClient.base_url = Field(..., alias="BaseUrl", description="Base URL of the AAS server.")
static

Definition at line 63 of file aas_client.py.

◆ base_url [2/2]

aas_client.AasHttpClient.base_url

Definition at line 87 of file aas_client.py.

◆ connection_time_out

int aas_client.AasHttpClient.connection_time_out = Field(default=100, alias="ConnectionTimeOut", description="Connection timeout for HTTP requests.")
static

Definition at line 70 of file aas_client.py.

◆ encoded_ids

bool aas_client.AasHttpClient.encoded_ids = Field(default=True, alias="EncodedIds", description="If enabled, all IDs used in API requests have to be base64-encoded.")
static

Definition at line 75 of file aas_client.py.

◆ experimental [1/2]

ExperimentalImplementation aas_client.AasHttpClient.experimental = Field(default=None)
static

Definition at line 79 of file aas_client.py.

◆ experimental [2/2]

aas_client.AasHttpClient.experimental

Definition at line 113 of file aas_client.py.

◆ http_proxy

str aas_client.AasHttpClient.http_proxy = Field(default=None, alias="HttpProxy", description="HTTP proxy URL.")
static

Definition at line 68 of file aas_client.py.

◆ https_proxy

str aas_client.AasHttpClient.https_proxy = Field(default=None, alias="HttpsProxy", description="HTTPS proxy URL.")
static

Definition at line 67 of file aas_client.py.

◆ model_config

aas_client.AasHttpClient.model_config = ConfigDict(populate_by_name=True, arbitrary_types_allowed=True)
static

Definition at line 61 of file aas_client.py.

◆ shell_registry [1/2]

ShellRegistryImplementation aas_client.AasHttpClient.shell_registry = Field(default=None)
static

Definition at line 78 of file aas_client.py.

◆ shell_registry [2/2]

aas_client.AasHttpClient.shell_registry

Definition at line 111 of file aas_client.py.

◆ shells [1/2]

ShellRepoImplementation aas_client.AasHttpClient.shells = Field(default=None)
static

Definition at line 76 of file aas_client.py.

◆ shells [2/2]

aas_client.AasHttpClient.shells

Definition at line 109 of file aas_client.py.

◆ ssl_verify

bool aas_client.AasHttpClient.ssl_verify = Field(default=True, alias="SslVerify", description="Enable SSL verification.")
static

Definition at line 71 of file aas_client.py.

◆ submodel_registry [1/2]

SubmodelRegistryImplementation aas_client.AasHttpClient.submodel_registry = Field(default=None)
static

Definition at line 80 of file aas_client.py.

◆ submodel_registry [2/2]

aas_client.AasHttpClient.submodel_registry

Definition at line 112 of file aas_client.py.

◆ submodels [1/2]

SubmodelRepoImplementation aas_client.AasHttpClient.submodels = Field(default=None)
static

Definition at line 77 of file aas_client.py.

◆ submodels [2/2]

aas_client.AasHttpClient.submodels

Definition at line 110 of file aas_client.py.

◆ time_out

int aas_client.AasHttpClient.time_out = Field(default=200, alias="TimeOut", description="Timeout for HTTP requests.")
static

Definition at line 69 of file aas_client.py.

◆ trust_env

bool aas_client.AasHttpClient.trust_env = Field(default=True, alias="TrustEnv", description="Trust environment variables.")
static

Definition at line 72 of file aas_client.py.


The documentation for this class was generated from the following file: