Skip to main content

Get Package

Description

Gets package via the web service.

Function Signature:

def get_package(ws_config: WebServiceConfig, package_id: int) -> PackageResult:

Parameters

  • ws_config (WebServiceConfig): Configuration for the web service connection.
  • package_id (int): Input value for package_id.

Returns

  • PackageResult: A result object containing:
    • code: HTTP status code (200 for success, -1 for exceptions).
    • description: Response body or error message.
    • package: Parsed response data when available.

Example Usage

# Example usage
ws_config = WebServiceConfig(access_key="key", secret_key="secret", base_url="https://api.example.com/")
package_id = 1
result = get_package(ws_config, package_id)
print(result)

Behavior

  • Sends a signed request to the web service.
  • On success (code 200), response data is parsed into the result object.
  • On success, returns the computed value or result object.

Error Handling

  • Exceptions set the result code to -1 and include an error message when implemented.