Skip to main content

Get Package List

Description

The get_package_list function retrieves a list of all packages available in the web service. It returns a WebServiceResult that includes the response data from the server.

Function Signature:

def get_package_list(ws_config: WebServiceConfig) -> WebServiceResult:

Parameters

  • ws_config (WebServiceConfig): Configuration object for the web service.

Returns

  • WebServiceResult: The result of the web service request, which includes:
    • http_response_code: The HTTP status code from the response.
    • http_response_string: The raw response body returned from the server.
    • json_data: Parsed JSON object containing the list of packages.

Example Usage

ws_config = WebServiceConfig(base_url="https://api.actionstreamer.com")

result = get_package_list(ws_config)
print(result.http_response_code, result.json_data)

Behavior

  • Sends a POST request to the web service at the /v1/package/list endpoint.
  • Returns all available packages listed by the server.
  • Populates a WebServiceResult object with the HTTP response and any returned JSON data.

Error Handling

  • General Exception: If an exception occurs during execution, the function captures the error, sets the response code to -1, and includes an error message in the result.