|
None | __init__ (self, str host="http://127.0.0.1", Union[int, None] port=6000, int delay=2, bool debug=False) |
|
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) |
|
requests.Response | head_endpoint (self, str path, Union[Dict[str, Any], None] content=None, Union[Mapping[str, str], None] header=None) |
|
requests.Response | options_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) |
|
str | get_content_type (self, requests.Response response) |
|
Dict[str, Union[str, bytes, Dict[str, Any], None]] | get_content (self, requests.Response response) |
|
Dict[str, Union[int, Dict[str, Union[str, bytes, Dict[str, Any], None]]]] | compile_response_data (self, requests.Response response) |
|
_summary_
This is the class in charge of containing the boilerplate endpoint functions.
Definition at line 22 of file query_boilerplate.py.
None src.lib.actions.query_boilerplate.QueryEndpoint.__init__ |
( |
| self, |
|
|
str | host = "http://127.0.0.1", |
|
|
Union[int, None] | port = 6000, |
|
|
int | delay = 2, |
|
|
bool | debug = False ) |
_summary_
Class in charge of containing the boilerplate endpoint functions to make queries to the web.
Args:
host (_type_, optional): _description_. Defaults to "http://127.0.0.1".
port (Union[int, None], optional): _description_. Defaults to 6000.
delay (int, optional): _description_. Defaults to 2.
debug (bool, optional): _description_. Defaults to False.
Definition at line 27 of file query_boilerplate.py.
Dict[str, Union[int, Dict[str, Union[str, bytes, Dict[str, Any], None]]]] src.lib.actions.query_boilerplate.QueryEndpoint.compile_response_data |
( |
| self, |
|
|
requests.Response | response ) |
Compile the response from an HTTP request into a dictionary.
Args:
response (requests.Response): The HTTP response from the server.
Returns:
Dict[str, Union[int, Dict[str, Union[str, bytes, Dict[str, Any], None]]]: A dictionary with the response status code and content.
Definition at line 341 of file query_boilerplate.py.
requests.Response src.lib.actions.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 173 of file query_boilerplate.py.
Dict[str, Union[str, bytes, Dict[str, Any], None]] src.lib.actions.query_boilerplate.QueryEndpoint.get_content |
( |
| self, |
|
|
requests.Response | response ) |
Retrieve and parse content from an HTTP response based on its Content-Type.
Args:
response (requests.Response): The HTTP response from the server.
Raises:
ValueError: If the response content is not valid JSON.
Returns:
Dict[str, Union[str, bytes, Dict[str, Any], None]]: A dictionary with parsed response content.
Contains two keys:
- ACONST.CONTENT_TYPE_KEY: str - The content type of the response.
- ACONST.CONTENT_KEY: Union[Dict[str, Any], str, bytes, None] - Parsed content.
- JSON (application/json, application/ld+json) -> Dict
- Text (text/html, text/plain, text/csv, text/xml) -> str
- XML (application/xml) -> str
- Binary data (e.g., application/octet-stream, application/pdf) -> bytes
- None for unhandled types.
Definition at line 288 of file query_boilerplate.py.
requests.Response src.lib.actions.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 57 of file query_boilerplate.py.
requests.Response src.lib.actions.query_boilerplate.QueryEndpoint.head_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 HEAD 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 202 of file query_boilerplate.py.
requests.Response src.lib.actions.query_boilerplate.QueryEndpoint.options_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 OPTIONS 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 231 of file query_boilerplate.py.
requests.Response src.lib.actions.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 144 of file query_boilerplate.py.
requests.Response src.lib.actions.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 86 of file query_boilerplate.py.
requests.Response src.lib.actions.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 115 of file query_boilerplate.py.