Terarea  2
The automation project
Loading...
Searching...
No Matches
query_boilerplate.QueryEndpoint Class Reference
Collaboration diagram for query_boilerplate.QueryEndpoint:
Collaboration graph

Public Member Functions

None __init__ (self, str host="http://127.0.0.1", int port=6000, int delay=2)
 
requests.Response get_endpoint (self, str path, Union[Dict[str, Any], None] content=None, Union[Mapping[str, str], None] header=None)
 
requests.Response post_endpoint (self, str path, Union[Dict[str, Any], None] content=None, Union[Mapping[str, str], None] header=None)
 
requests.Response put_endpoint (self, str path, Union[Dict[str, Any], None] content=None, Union[Mapping[str, str], None] header=None)
 
requests.Response patch_endpoint (self, str path, Union[Dict[str, Any], None] content=None, Union[Mapping[str, str], None] header=None)
 
requests.Response delete_endpoint (self, str path, Union[Dict[str, Any], None] content=None, Union[Mapping[str, str], None] header=None)
 
int get_status (self, requests.Response response)
 

Protected Attributes

str _host = f"http://{host}"
 
 _port = port
 
 _delay = delay
 

Detailed Description

_summary_
    This is the class in charge of containing the boilerplate endpoint functions.

Definition at line 5 of file query_boilerplate.py.

Constructor & Destructor Documentation

◆ __init__()

None query_boilerplate.QueryEndpoint.__init__ ( self,
str host = "http://127.0.0.1",
int port = 6000,
int delay = 2 )

Definition at line 10 of file query_boilerplate.py.

Member Function Documentation

◆ delete_endpoint()

requests.Response query_boilerplate.QueryEndpoint.delete_endpoint ( self,
str path,
Union[Dict[str, Any], None] content = None,
Union[Mapping[str, str], None] header = None )
_summary_
    This function is in charge of sending a DELETE request to the server.
Args:
    path (str): _description_: The path of the endpoint.
    content (Union[Dict[str, Any], None], optional): _description_: The content to be sent to the server.
    header (Union[Mapping[str, str], None], optional): _description_: The header to be sent to the server. Defaults to None.
Returns:
    requests.Response: _description_: The response from the server.

Definition at line 114 of file query_boilerplate.py.

◆ get_endpoint()

requests.Response query_boilerplate.QueryEndpoint.get_endpoint ( self,
str path,
Union[Dict[str, Any], None] content = None,
Union[Mapping[str, str], None] header = None )
_summary_
    This function is in charge of sending a GET request to the server.
Args:
    path (str): _description_: The path of the endpoint.
    content (Union[Dict[str, Any], None], optional): _description_: The content to be sent to the server.
    header (Union[Mapping[str, str], None], optional): _description_: The header to be sent to the server. Defaults to None.
Returns:
    requests.Response: _description_: The response from the server.

Definition at line 18 of file query_boilerplate.py.

◆ get_status()

int query_boilerplate.QueryEndpoint.get_status ( self,
requests.Response response )
_summary_
    This function is in charge of getting the status code from the response.
Args:
    response (requests.Response): _description_: The response from the server.
Returns:
    int: _description_: The status code from the response.

Definition at line 138 of file query_boilerplate.py.

◆ patch_endpoint()

requests.Response query_boilerplate.QueryEndpoint.patch_endpoint ( self,
str path,
Union[Dict[str, Any], None] content = None,
Union[Mapping[str, str], None] header = None )
_summary_
    This function is in charge of sending a PATCH request to the server.
Args:
    path (str): _description_: The path of the endpoint.
    content (Union[Dict[str, Any], None], optional): _description_: The content to be sent to the server.
    header (Union[Mapping[str, str], None], optional): _description_: The header to be sent to the server. Defaults to None.
Returns:
    requests.Response: _description_: The response from the server.

Definition at line 90 of file query_boilerplate.py.

◆ post_endpoint()

requests.Response query_boilerplate.QueryEndpoint.post_endpoint ( self,
str path,
Union[Dict[str, Any], None] content = None,
Union[Mapping[str, str], None] header = None )
_summary_
    This function is in charge of sending a POST request to the server.
Args:
    path (str): _description_: The path of the endpoint.
    content (Union[Dict[str, Any], None], optional): _description_: The content to be sent to the server.
    header (Union[Mapping[str, str], None], optional): _description_: The header to be sent to the server. Defaults to None.
Returns:
    requests.Response: _description_: The response from the server.

Definition at line 42 of file query_boilerplate.py.

◆ put_endpoint()

requests.Response query_boilerplate.QueryEndpoint.put_endpoint ( self,
str path,
Union[Dict[str, Any], None] content = None,
Union[Mapping[str, str], None] header = None )
_summary_
    This function is in charge of sending a PUT request to the server.
Args:
    path (str): _description_: The path of the endpoint.
    content (Union[Dict[str, Any], None], optional): _description_: The content to be sent to the server.
    header (Union[Mapping[str, str], None], optional): _description_: The header to be sent to the server. Defaults to None.
Returns:
    requests.Response: _description_: The response from the server.

Definition at line 66 of file query_boilerplate.py.

Field Documentation

◆ _delay

query_boilerplate.QueryEndpoint._delay = delay
protected

Definition at line 16 of file query_boilerplate.py.

◆ _host

str query_boilerplate.QueryEndpoint._host = f"http://{host}"
protected

Definition at line 12 of file query_boilerplate.py.

◆ _port

query_boilerplate.QueryEndpoint._port = port
protected

Definition at line 15 of file query_boilerplate.py.


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