diff --git a/examples/check_device.py b/examples/check_device.py index 2242c4b..300f475 100644 --- a/examples/check_device.py +++ b/examples/check_device.py @@ -6,12 +6,14 @@ This script connects to an ONVIF-compliant device and retrieves basic information such as device details and scopes using the Core (Device Management) service. +And using to_dict() (>= v0.2.8 patch) function to convert the response to a dictionary. """ +import json from onvif import ONVIFClient HOST = "192.168.1.3" -PORT = 80 +PORT = 8000 USERNAME = "admin" PASSWORD = "admin123" @@ -20,9 +22,9 @@ device = client.devicemgmt() # print device information - print(device.GetDeviceInformation()) + print(json.dumps(device.GetDeviceInformation().to_dict(), indent=4)) # print device scopes - print(device.GetScopes()) + print(json.dumps(device.GetScopes().to_dict(), indent=4)) except Exception as e: print(e)