Package: onvif-zeep
python-onvif-zeep============ONVIF Client Implementation in PythonDependencies------------`zeep <http://docs.python-zeep.org>`_ >= 3.0.0Install python-onvif-zeep-------------------------**From Source**You should clone this repository and run setup.py::cd python-onvif-zeep && python setup.py installAlternatively, you can run::pip install --upgrade onvif_zeepGetting Started---------------Initialize an ONVIFCamera instance~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~::from onvif import ONVIFCameramycam = ONVIFCamera('192.168.0.2', 80, 'user', 'passwd', '/etc/onvif/wsdl/')Now, an ONVIFCamera instance is available. By default, a devicemgmt service is also available if everything is OK.So, all operations defined in the WSDL document::/etc/onvif/wsdl/devicemgmt.wsdlare available.Get information from your camera~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~::# Get Hostnameresp = mycam.devicemgmt.GetHostname()print 'My camera`s hostname: ' + str(resp.Name)# Get system date and timedt = mycam.devicemgmt.GetSystemDateAndTime()tz = dt.TimeZoneyear = dt.UTCDateTime.Date.Yearhour = dt.UTCDateTime.Time.HourConfigure (Control) your camera~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~To configure your camera, there are two ways to pass parameters to service methods.**Dict**This is the simpler way::params = {'Name': 'NewHostName'}device_service.SetHostname(params)**Type Instance**This is the recommended way. Type instance will raise anexception if you set an invalid (or non-existent) parameter.::params = mycam.devicemgmt.create_type('SetHostname')params.Hostname = 'NewHostName'mycam.devicemgmt.SetHostname(params)time_params = mycam.devicemgmt.create_type('SetSystemDateAndTime')time_params.DateTimeType = 'Manual'time_params.DaylightSavings = Truetime_params.TimeZone.TZ = 'CST-8:00:00'time_params.UTCDateTime.Date.Year = 2014time_params.UTCDateTime.Date.Month = 12time_params.UTCDateTime.Date.Day = 3time_params.UTCDateTime.Time.Hour = 9time_params.UTCDateTime.Time.Minute = 36time_params.UTCDateTime.Time.Second = 11mycam.devicemgmt.SetSystemDateAndTime(time_params)Use other services~~~~~~~~~~~~~~~~~~ONVIF protocol has defined many services.You can find all the services and operations `here <http://www.onvif.org/onvif/ver20/util/operationIndex.html>`_.ONVIFCamera has support methods to create new services::# Create ptz serviceptz_service = mycam.create_ptz_service()# Get ptz configurationmycam.ptz.GetConfiguration()# Another way# ptz_service.GetConfiguration()Or create an unofficial service::xaddr = 'http://192.168.0.3:8888/onvif/yourservice'yourservice = mycam.create_onvif_service('service.wsdl', xaddr, 'yourservice')yourservice.SomeOperation()# Another way# mycam.yourservice.SomeOperation()ONVIF CLI---------python-onvif also provides a command line interactive interface: onvif-cli.onvif-cli is installed automatically.Single command example~~~~~~~~~~~~~~~~~~~~~~::$ onvif-cli devicemgmt GetHostname --user 'admin' --password '12345' --host '192.168.0.112' --port 80True: {'FromDHCP': True, 'Name': hision}$ onvif-cli devicemgmt SetHostname "{'Name': 'NewerHostname'}" --user 'admin' --password '12345' --host '192.168.0.112' --port 80True: {}Interactive mode~~~~~~~~~~~~~~~~::$ onvif-cli -u 'admin' -a '12345' --host '192.168.0.112' --port 80 --wsdl /etc/onvif/wsdl/ONVIF >>> cmdanalytics   devicemgmt  events      imaging     media       ptzONVIF >>> cmd devicemgmt GetWsdlUrlTrue: http://www.onvif.org/ONVIF >>> cmd devicemgmt SetHostname {'Name': 'NewHostname'}ONVIF >>> cmd devicemgmt GetHostnameTrue: {'Name': 'NewHostName'}ONVIF >>> cmd devicemgmt SomeOperationFalse: No Operation: SomeOperationNOTE: Tab completion is supported for interactive mode.Batch mode~~~~~~~~~~::$ vim batchcmds$ cat batchcmdscmd devicemgmt GetWsdlUrlcmd devicemgmt SetHostname {'Name': 'NewHostname', 'FromDHCP': True}cmd devicemgmt GetHostname$ onvif-cli --host 192.168.0.112 -u admin -a 12345 -w /etc/onvif/wsdl/ < batchcmdsONVIF >>> True: http://www.onvif.org/ONVIF >>> True: {}ONVIF >>> True: {'FromDHCP': False, 'Name': NewHostname}References----------* `ONVIF Offical Website <http://www.onvif.com>`_* `Operations Index <http://www.onvif.org/onvif/ver20/util/operationIndex.html>`_* `ONVIF Develop Documents <http://www.onvif.org/specs/DocMap-2.4.2.html>`_* `Foscam Python Lib <http://github.com/quatanium/foscam-python-lib>`_