AAS HTTP Client Documentation
Loading...
Searching...
No Matches
aas_http_client.utilities.http_helper Namespace Reference

Functions

 log_response (Response response, int log_level=logging.ERROR)
 Extracts and logs error messages from an HTTP response.
 

Variables

 _logger
 
int STATUS_CODE_200 = 200
 
int STATUS_CODE_201 = 201
 
int STATUS_CODE_202 = 202
 
int STATUS_CODE_204 = 204
 
int STATUS_CODE_404 = 404
 

Function Documentation

◆ log_response()

aas_http_client.utilities.http_helper.log_response ( Response  response,
int   log_level = logging.ERROR 
)

Extracts and logs error messages from an HTTP response.

This method parses the response content for error details, messages, or error fields, and logs each error message found. If the response cannot be decoded as JSON, it logs the raw response content. Always logs the HTTP status code.

Parameters
responseThe HTTP response object to extract and log errors from
log_levelThe logging level to use (default is logging.ERROR)

Definition at line 29 of file http_helper.py.

Variable Documentation

◆ _logger

aas_http_client.utilities.http_helper._logger
protected

Definition at line 11 of file http_helper.py.

◆ STATUS_CODE_200

int aas_http_client.utilities.http_helper.STATUS_CODE_200 = 200

Definition at line 13 of file http_helper.py.

◆ STATUS_CODE_201

int aas_http_client.utilities.http_helper.STATUS_CODE_201 = 201

Definition at line 14 of file http_helper.py.

◆ STATUS_CODE_202

int aas_http_client.utilities.http_helper.STATUS_CODE_202 = 202

Definition at line 15 of file http_helper.py.

◆ STATUS_CODE_204

int aas_http_client.utilities.http_helper.STATUS_CODE_204 = 204

Definition at line 16 of file http_helper.py.

◆ STATUS_CODE_404

int aas_http_client.utilities.http_helper.STATUS_CODE_404 = 404

Definition at line 17 of file http_helper.py.