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.
 
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

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
 
 _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)
 

Detailed Description

Represents a AasHttpClient to communicate with a REST API.

Definition at line 36 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 99 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 285 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 190 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 128 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 93 of file aas_client.py.

◆ initialize()

aas_client.AasHttpClient.initialize (   self)

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

Definition at line 59 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 262 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 238 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 214 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 160 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 49 of file aas_client.py.

◆ _auth_method [2/2]

aas_client.AasHttpClient._auth_method
protected

Definition at line 101 of file aas_client.py.

◆ _cached_token [1/2]

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

Definition at line 56 of file aas_client.py.

◆ _cached_token [2/2]

aas_client.AasHttpClient._cached_token
protected

Definition at line 178 of file aas_client.py.

◆ _session [1/2]

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

Definition at line 48 of file aas_client.py.

◆ _session [2/2]

aas_client.AasHttpClient._session
protected

Definition at line 63 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 39 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 38 of file aas_client.py.

◆ base_url [2/2]

aas_client.AasHttpClient.base_url

Definition at line 61 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 45 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 50 of file aas_client.py.

◆ experimental [1/2]

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

Definition at line 54 of file aas_client.py.

◆ experimental [2/2]

aas_client.AasHttpClient.experimental

Definition at line 87 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 43 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 42 of file aas_client.py.

◆ shell_registry [1/2]

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

Definition at line 53 of file aas_client.py.

◆ shell_registry [2/2]

aas_client.AasHttpClient.shell_registry

Definition at line 85 of file aas_client.py.

◆ shells [1/2]

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

Definition at line 51 of file aas_client.py.

◆ shells [2/2]

aas_client.AasHttpClient.shells

Definition at line 83 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 46 of file aas_client.py.

◆ submodel_registry [1/2]

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

Definition at line 55 of file aas_client.py.

◆ submodel_registry [2/2]

aas_client.AasHttpClient.submodel_registry

Definition at line 86 of file aas_client.py.

◆ submodels [1/2]

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

Definition at line 52 of file aas_client.py.

◆ submodels [2/2]

aas_client.AasHttpClient.submodels

Definition at line 84 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 44 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 47 of file aas_client.py.


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