colda.network package
Submodules
colda.network.api module
- class colda.network.api.DP
Bases:
object
Data processing Parse http response
Methods
load_network_response
- class colda.network.api.Network
Bases:
BaseNetwork
Handle network http requests
Attributes
base_url token
Methods
get_instance process_url get_request post_request get_request_chaining post_request_chaining logout
- property base_url: str
Get the ipv4 address of AWS server
Returns
- str
the ipv4 address of AWS server
- classmethod delete()
- classmethod get_instance() Network
Singleton pattern. Get instance of current class.
Returns
Network
- get_request(url: str, token: str, request_name: str) Dict[str, Any] | List[Any]
Initiate a http get network request. Get the data returned by the http get network request.
Parameters
url : str token : str request_name : str
request_name is used for debugging
Returns
JSONType
- get_request_chaining(url_prefix: str, url_root: str, url_suffix: str | None = None, status_code: int = 200) dict[str, Union[list[str], str]]
- Handle the http get request flow:
generate url
http get request
parse http get response
Parameters
data : JSONType url_prefix : str url_root : str url_suffix : str status_code : int
Returns
dict
- post_request(url: str, token: str, request_name: str, data: dict[str, Union[list[str], str]]) Dict[str, Any] | List[Any]
Initiate a http post network request. Get the data returned by the http post network request.
Parameters
url : str token : str request_name : str
request_name is used for debugging
- datadict[str, Union[list[str], str]]
data that needs to be sent to the backend
Returns
JSONType
- post_request_chaining(data: dict[str, Union[list[str], str]], url_prefix: str, url_root: str, url_suffix: str | None = None, status_code: int = 200) dict[str, Union[list[str], str]]
- Handle the http post request flow:
generate url
http post request
parse http post response
Parameters
data : JSONType url_prefix : str url_root : str url_suffix : str status_code : int
Returns
dict
- process_url(url_prefix: str, url_root: str, url_suffix: str | None = None) str
Add prefix and suffix to url_root
Parameters
url_prefix : str url_root : str url_suffix : str
Returns
str
- test_network(url_prefix: str, url_root: str, url_suffix: str | None = None, status_code: int = 200) str
colda.network.base module
colda.network.dp module
- class colda.network.dp.DP
Bases:
object
Data processing Parse http response
Methods
load_network_response
colda.network.network module
- class colda.network.network.Network
Bases:
BaseNetwork
Handle network http requests
Attributes
base_url token
Methods
get_instance process_url get_request post_request get_request_chaining post_request_chaining logout
- property base_url: str
Get the ipv4 address of AWS server
Returns
- str
the ipv4 address of AWS server
- classmethod delete()
- classmethod get_instance() Network
Singleton pattern. Get instance of current class.
Returns
Network
- get_request(url: str, token: str, request_name: str) Dict[str, Any] | List[Any]
Initiate a http get network request. Get the data returned by the http get network request.
Parameters
url : str token : str request_name : str
request_name is used for debugging
Returns
JSONType
- get_request_chaining(url_prefix: str, url_root: str, url_suffix: str | None = None, status_code: int = 200) dict[str, Union[list[str], str]]
- Handle the http get request flow:
generate url
http get request
parse http get response
Parameters
data : JSONType url_prefix : str url_root : str url_suffix : str status_code : int
Returns
dict
- post_request(url: str, token: str, request_name: str, data: dict[str, Union[list[str], str]]) Dict[str, Any] | List[Any]
Initiate a http post network request. Get the data returned by the http post network request.
Parameters
url : str token : str request_name : str
request_name is used for debugging
- datadict[str, Union[list[str], str]]
data that needs to be sent to the backend
Returns
JSONType
- post_request_chaining(data: dict[str, Union[list[str], str]], url_prefix: str, url_root: str, url_suffix: str | None = None, status_code: int = 200) dict[str, Union[list[str], str]]
- Handle the http post request flow:
generate url
http post request
parse http post response
Parameters
data : JSONType url_prefix : str url_root : str url_suffix : str status_code : int
Returns
dict
- process_url(url_prefix: str, url_root: str, url_suffix: str | None = None) str
Add prefix and suffix to url_root
Parameters
url_prefix : str url_root : str url_suffix : str
Returns
str
- test_network(url_prefix: str, url_root: str, url_suffix: str | None = None, status_code: int = 200) str