Last active
March 10, 2020 13:37
-
-
Save raiever/dc2898d0acc3966fe640111f1393081a to your computer and use it in GitHub Desktop.
ONVIF test using zeep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from zeep.client import Client, CachingClient, Settings | |
from zeep.wsse.username import UsernameToken | |
import zeep.helpers | |
import logging.config | |
# Put Zeep into verbose mode | |
logging.config.dictConfig({ | |
'version': 1, | |
'formatters': { | |
'verbose': { | |
'format': '%(name)s: %(message)s' | |
} | |
}, | |
'handlers': { | |
'console': { | |
'level': 'DEBUG', | |
'class': 'logging.StreamHandler', | |
'formatter': 'verbose', | |
}, | |
}, | |
'loggers': { | |
'zeep.transports': { | |
'level': 'DEBUG', | |
'propagate': True, | |
'handlers': ['console'], | |
}, | |
} | |
}) | |
ip="192.168.2.195"; user="admin"; passwd="H*******"; port=80 | |
settings = Settings() | |
settings.strict = False | |
settings.xml_huge_tree = True | |
# WSDL File | |
url = "https://www.onvif.org/ver10/device/wsdl/devicemgmt.wsdl" | |
# *** Devicemgmt Service *** | |
xaddr = "http://"+ip+"/onvif/device_service" | |
print("creating a soap client with url = ", url) | |
zeep_client_device = CachingClient(wsdl=url, wsse=UsernameToken(user, passwd, use_digest=True), settings=settings) | |
print("soap client created") | |
print("binding to service") | |
ws_client_device = zeep_client_device.create_service("{http://www.onvif.org/ver10/device/wsdl}DeviceBinding", xaddr) | |
print("service OK") | |
ws_client_device.GetCapabilities(Category='Device') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment