Update Health
Description
Updates health via the web service.
Function Signature:
def update_health(ws_config: WebServiceConfig, device_serial: str, health_json: str) -> IntegerResult:
Parameters
- ws_config (WebServiceConfig): Configuration for the web service connection.
- device_serial (str): Device serial number.
- health_json (str): Serialized health JSON payload.
Returns
- IntegerResult: A result object containing:
code: HTTP status code (200 for success,-1for exceptions).description: Response body or error message.value: Parsed response data when available.
Example Usage
# Example usage
ws_config = WebServiceConfig(access_key="key", secret_key="secret", base_url="https://api.example.com/")
device_serial = "example"
health_json = "example"
result = update_health(ws_config, device_serial, health_json)
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
-1and include an error message when implemented.