Git Product home page Git Product logo

python-onvif-zeep's Introduction

python-onvif-zeep

ONVIF Client Implementation in Python

Dependencies

zeep >= 3.0.0

Install python-onvif-zeep

From Source

You should clone this repository and run setup.py:

cd python-onvif-zeep && python setup.py install

Alternatively, you can run:

pip install --upgrade onvif_zeep

Getting Started

Initialize an ONVIFCamera instance

from onvif import ONVIFCamera
mycam = 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.wsdl

are available.

Get information from your camera

# Get Hostname
resp = mycam.devicemgmt.GetHostname()
print 'My camera`s hostname: ' + str(resp.Name)

# Get system date and time
dt = mycam.devicemgmt.GetSystemDateAndTime()
tz = dt.TimeZone
year = dt.UTCDateTime.Date.Year
hour = dt.UTCDateTime.Time.Hour

Configure (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 an exception 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 = True
time_params.TimeZone.TZ = 'CST-8:00:00'
time_params.UTCDateTime.Date.Year = 2014
time_params.UTCDateTime.Date.Month = 12
time_params.UTCDateTime.Date.Day = 3
time_params.UTCDateTime.Time.Hour = 9
time_params.UTCDateTime.Time.Minute = 36
time_params.UTCDateTime.Time.Second = 11
mycam.devicemgmt.SetSystemDateAndTime(time_params)

Use other services

ONVIF protocol has defined many services. You can find all the services and operations here. ONVIFCamera has support methods to create new services:

# Create ptz service
ptz_service = mycam.create_ptz_service()
# Get ptz configuration
mycam.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 80
True: {'FromDHCP': True, 'Name': hision}
$ onvif-cli devicemgmt SetHostname "{'Name': 'NewerHostname'}" --user 'admin' --password '12345' --host '192.168.0.112' --port 80
True: {}

Interactive mode

$ onvif-cli -u 'admin' -a '12345' --host '192.168.0.112' --port 80 --wsdl /etc/onvif/wsdl/
ONVIF >>> cmd
analytics   devicemgmt  events      imaging     media       ptz
ONVIF >>> cmd devicemgmt GetWsdlUrl
True: http://www.onvif.org/
ONVIF >>> cmd devicemgmt SetHostname {'Name': 'NewHostname'}
ONVIF >>> cmd devicemgmt GetHostname
True: {'Name': 'NewHostName'}
ONVIF >>> cmd devicemgmt SomeOperation
False: No Operation: SomeOperation

NOTE: Tab completion is supported for interactive mode.

Batch mode

$ vim batchcmds
$ cat batchcmds
cmd devicemgmt GetWsdlUrl
cmd devicemgmt SetHostname {'Name': 'NewHostname', 'FromDHCP': True}
cmd devicemgmt GetHostname
$ onvif-cli --host 192.168.0.112 -u admin -a 12345 -w /etc/onvif/wsdl/ < batchcmds
ONVIF >>> True: http://www.onvif.org/
ONVIF >>> True: {}
ONVIF >>> True: {'FromDHCP': False, 'Name': NewHostname}

References

python-onvif-zeep's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-onvif-zeep's Issues

zeep.exceptions.Fault: Method 'soap-env:Envelope' not implemented: method name or namespace not recognized

hey,
anyone can help me? in Zeep the method soap-env:Envelope isn't implemented.. this is my code

....
#access media service
media = mycam.create_media_service()                

profiles = media.GetProfiles()

# Use the first profile and Profiles have at least one
token = profiles[0].token
snapshot = media.GetSnapshotUri({'ProfileToken' : token})
print ('My Cam: ' + str(snapshot))

OUTPUT
`Traceback (most recent call last):
File "C:\Program Files\Python37\lib\site-packages\onvif_zeep-0.2.12-py3.7.egg\onvif\client.py", line 23, in wrapped
return func(*args, **kwargs)
File "C:\Program Files\Python37\lib\site-packages\onvif_zeep-0.2.12-py3.7.egg\onvif\client.py", line 153, in wrapped
return call(params, callback)
File "C:\Program Files\Python37\lib\site-packages\onvif_zeep-0.2.12-py3.7.egg\onvif\client.py", line 140, in call
ret = func(**params)
File "C:\Program Files\Python37\lib\site-packages\zeep-3.1.0-py3.7.egg\zeep\proxy.py", line 42, in call
self._op_name, args, kwargs)
File "C:\Program Files\Python37\lib\site-packages\zeep-3.1.0-py3.7.egg\zeep\wsdl\bindings\soap.py", line 132, in send
return self.process_reply(client, operation_obj, response)
File "C:\Program Files\Python37\lib\site-packages\zeep-3.1.0-py3.7.egg\zeep\wsdl\bindings\soap.py", line 194, in process_reply
return self.process_error(doc, operation)
File "C:\Program Files\Python37\lib\site-packages\zeep-3.1.0-py3.7.egg\zeep\wsdl\bindings\soap.py", line 349, in process_error
subcodes=subcodes)
zeep.exceptions.Fault: Method 'soap-env:Envelope' not implemented: method name or namespace not recognized

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File ".\onvifCapture.py", line 19, in
snapshot = media.GetSnapshotUri({'ProfileToken' : token})
File "C:\Program Files\Python37\lib\site-packages\onvif_zeep-0.2.12-py3.7.egg\onvif\client.py", line 26, in wrapped
raise ONVIFError(err)
onvif.exceptions.ONVIFError: Unknown error: Method 'soap-env:Envelope' not implemented: method name or namespace not recognized`

WARNING:urllib3.connectionpool:Failed to parse headers

Importing onvif or ONVIFCamera from onvif raises this issue while also using requests.get

Commenting out lines 6,7,8, and 9 inside of client.py has resolved the issue for me. Not sure if best method or negative side effects yet, but so far none.

Here is the full error with the url address commented out:

WARNING:urllib3.connectionpool:Failed to parse headers (url=####################): [MissingHeaderBodySeparatorDefect()], unparsed data: '(17320) sif_util.c:SIiUTIL_GetMacByIfName[2345]: ioctl: get ra0 mac error. No such device\nStatus: 200 OK\r\nContent-type: text/plain\r\n\r\n'
Traceback (most recent call last):
File "C:\Python\lib\site-packages\urllib3\connectionpool.py", line 399, in _make_request
assert_header_parsing(httplib_response.msg)
File "C:\Python\lib\site-packages\urllib3\util\response.py", line 66, in assert_header_parsing
raise HeaderParsingError(defects=defects, unparsed_data=unparsed_data)
urllib3.exceptions.HeaderParsingError: [MissingHeaderBodySeparatorDefect()], unparsed data: '(17320) sif_util.c:SIiUTIL_GetMacByIfName[2345]: ioctl: get ra0 mac error. No such device\nStatus: 200 OK\r\nContent-type: text/plain\r\n\r\n'

NotImplementedError: AnySimpleType.pytonvalue() not implemented

Here is my code(Run with python 3.6 and python-onvif-0.2.0 ):
from onvif import ONVIFCamera, ONVIFError
mycam = ONVIFCamera('192.168.1.64', 80, 'admin', 'admin12345', 'C:\ProgramData\Anaconda3\Lib\site-packages\onvif-0.2.0-py3.6.egg\wsdl')
media = mycam.create_media_service()
media_profile = media.GetProfiles()[0]

And what I get:
1
2

How can i fixed it?

Examples do not work

I installed the latest version of the python-onvif-zeep, but examples from repository do not work.
I am faced with the following problem:

Traceback (most recent call last): File "examples/continuous_move.py", line 85, in <module> continuous_move() File "examples/continuous_move.py", line 56, in continuous_move request.ConfigurationToken = media_profile.PTZConfiguration._token File "/usr/lib/python2.7/site-packages/zeep-2.5.0-py2.7.egg/zeep/xsd/valueobjects.py", line 142, in __getattribute__ self.__class__.__name__, key)) AttributeError: PTZConfiguration instance has no attribute '_token'

Similarly for Python3.4:

Traceback (most recent call last): File "examples/continuous_move.py", line 85, in <module> continuous_move() File "examples/continuous_move.py", line 56, in continuous_move request.ConfigurationToken = media_profile.PTZConfiguration._token File "/usr/lib/python3.4/site-packages/zeep-2.5.0-py3.4.egg/zeep/xsd/valueobjects.py", line 142, in __getattribute__ self.__class__.__name__, key)) AttributeError: PTZConfiguration instance has no attribute '_token'

In this regard, I have to correct the relevant places in the code: Object._token --> Object.token, to eliminate these errors.
Please, tell me where does this bug come from?

command python3 -mzeep https://www.onvif.org/ver10/device/wsdl/devicemgmt.wsdl fails

working from commit: aae3def4385b0f8922e0e83b9cdcd68b2263f739

command python3 -mzeep https://www.onvif.org/ver10/device/wsdl/devicemgmt.wsdl fails

The command fails while processing this code fragment of the file onvif.xsd:

        <xs:complexType name="CapabilitiesExtension">
                <xs:sequence>
                        <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unboundedaae3def4385b0f8922e0e83b9cdcd68b2263f739"/>
                        <xs:element name="DeviceIO" type="tt:DeviceIOCapabilities" minOccurs="0"/>
                        <xs:element name="Display" type="tt:DisplayCapabilities" minOccurs="0"/>

The exception message is as follows:

egg/zeep/xsd/types/complex.py", line 530, in signature
    value = ", ".join(parts)
TypeError: sequence item 0: expected str instance, NoneType found

I put the a patch in zeep/xsd/complex.py to work around this problem but wondering if this is a bigger problem. I've found another issue, but not directly related issue with this xml fragment that I'll post separately. .

This is the patched signature method.

    def signature(self, schema=None, standalone=True):
        parts = []
        LetAppendNull = True # set to true to let it fail
        for name, element in self.elements_nested:
            part = element.signature(schema, standalone=False)
            if LetAppendNull or part != None:
            	parts.append(part)

        for name, attribute in self.attributes:
            part = "%s: %s" % (name, attribute.signature(schema, standalone=False))
            if LetAppendNull or part != None:
            	parts.append(part)

        value = ", ".join(parts)
        if standalone:
            return "%s(%s)" % (self.get_prefixed_name(schema), value)
        else:
            return value

create_type() doesn't return correct data structure

The following code is supposed to set parameters of RelayOutput:

params = mycam.devicemgmt.create_type('SetRelayOutputSettings')
params.RelayOutputToken = 'AlarmOut_0'
\# params.Properties.Mode = 'Bistable'
\# params.Properties.DelayTime = 'PT1S'
\# params.Properties.IdleState = 'closed'
params.Properties = {'Mode':'Bistable','DelayTime':'PT1S','IdleState':'closed'} this way doesn't work too
mycam.devicemgmt.SetRelayOutputSettings(params)
mycam.devicemgmt.SetRelayOutputState({'RelayOutputToken':'AlarmOut_0','LogicalState':'active'})

But it fails:

raise ONVIFError(err)
onvif.exceptions.ONVIFError: Unknown error: Validation constraint violation: data type mismatch  in element 'ns2:DelayTime'

If I try explicit definition of SetRelayOutputSettings fields another error returned:

\>\>\> params.Properties.Mode = 'Bistable'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'Mode'
\>\>\> params.Properties.DelayTime = 'PT1S'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'DelayTime'
\>\>\> params.Properties.IdleState = 'closed'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'IdleState'

print(params) returns following:

\>\>\> print(params)
{
    'RelayOutputToken': None,
    'Properties': None
}

Which is pretty much different from what is returned by Python 2.7 version of library:

\>\>\> params = mycam.devicemgmt.create_type('SetRelayOutputSettings')
\>\>\> print(params)
(SetRelayOutputSettings){
   RelayOutputToken = None
   Properties =
      (RelayOutputSettings){
         Mode =
            (RelayMode){
               value = None
            }
         DelayTime = None
         IdleState =
            (RelayIdleState){
               value = None
            }
      }
 }

Also I tried to execute example with mycam.devicemgmt.create_type('SetSystemDateAndTime') and got the same kind of error. So I assume something is wrong with implementation of .create_type() function. Am I missing some difference between libraries for Python 2.7 and Python 3 or it's an error that should be fixed?

ONVIFError: Unknown error: AnySimpleType.pytonvalue() not implemented

Trying to retrieve Events using this line:

search_service.GetEventSearchResults({'SearchToken': '721815711'})

Raises:

raise ONVIFError(err)
      onvif.exceptions.ONVIFError: Unknown error: AnySimpleType.pytonvalue() not implemented

Same result by setting search token as integer.

remotediscovery example

Is there an example to do remote discovery? I am having a trouble figuring it out. I guess I need to use create_onvif_service. But what portType parameter I should give?

Enabling H265

Newer versions of ONVIF supposedly allow enabling of H265 streaming. Is it just a matter of upgrading the wdsl specifications?

Can't Move the PTZ camera - Error

Running the example continuous_move.py
>>> moverequest { 'ProfileToken': '0', 'Velocity': { 'PanTilt': { 'x': 0.57, 'y': -0.44, 'space': 'http://www.onvif.org/ver10/tptz/PanTiltSpaces/PositionGenericSpace' }, 'Zoom': { 'x': 0.0, 'space': 'http://www.onvif.org/ver10/tptz/ZoomSpaces/PositionGenericSpace' } }, 'Timeout': None }

`>>> ptz.ContinuousMove(moverequest)
Traceback (most recent call last):
File "/home/myuser/Documents/python-onvif-zeep/onvif/client.py", line 25, in wrapped
return func(*args, **kwargs)
File "/home/myuser/Documents/python-onvif-zeep/onvif/client.py", line 150, in wrapped
return call(params, callback)
File "/home/myuser/Documents/python-onvif-zeep/onvif/client.py", line 138, in call
ret = func(**params)
File "/usr/local/lib/python3.7/dist-packages/zeep/proxy.py", line 45, in call
kwargs,
File "/usr/local/lib/python3.7/dist-packages/zeep/wsdl/bindings/soap.py", line 130, in send
return self.process_reply(client, operation_obj, response)
File "/usr/local/lib/python3.7/dist-packages/zeep/wsdl/bindings/soap.py", line 195, in process_reply
return self.process_error(doc, operation)
File "/usr/local/lib/python3.7/dist-packages/zeep/wsdl/bindings/soap.py", line 362, in process_error
subcodes=subcodes,
zeep.exceptions.Fault: Action Failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "", line 1, in
File "/home/myuser/Documents/python-onvif-zeep/onvif/client.py", line 27, in wrapped
raise ONVIFError(err)
onvif.exceptions.ONVIFError: Unknown error: Action Failed`

Unable to parse components in Onvif device GetCapabilities reply extension

Using commit aae3def4385b0f8922e0e83b9cdcd68b2263f739

The onvif device_service GetCapabilities reply has an extension section within it that zeep does not follow and parse and resolve into pythons objects attached to the result, which I think should be the behavior. The type in question, "CapabilitiesExtension", is declared in onvif.xsd, see below. I found through experimentation that by commenting out the line containing xs:any namespace="##other" in onvif.xsd II can see the objects properly. I've traced through the parsing code quite a bit and so far haven't found the problem.

The offending fragment in onvif.xsd

`  <xs:complexType name="CapabilitiesExtension">
      <xs:sequence>
<!-- Comment out this next kline and GetCababilities will work-->
           <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
             <xs:element name="DeviceIO" type="tt:DeviceIOCapabilities" minOccurs="0"/>
              <xs:element name="Display" type="tt:DisplayCapabilities" minOccurs="0"/>

This code fragment below may be executed as a python script to show the problem. You must have access to an onvif camera with DeviceIO extensions, or edit the script if it supports another extension but not DeviceIO, and edit the login credentials and camera IP address to run it.

from zeep.client import Client, CachingClient, Settings
from zeep.proxy import ServiceProxy
from zeep.wsse.username import UsernameToken

def showbug():

    # Provide valid credentials for an Onvif camera that has at least one populate entry in DeviceCapabilities extension sectio
    # change to your userid, password, ip address
    user='user'
    passwd='password'
    IpAddress='172.32.12.33'
    Port = 80

    xaddr='http://{}:{}/onvif/device_service'.format(IpAddress,Port)

    wsse = UsernameToken(user, passwd, use_digest=True)
    settings = Settings()
    settings.strict = False
    settings.xml_huge_tree = True
    client = Client(wsdl='https://www.onvif.org/ver10/device/wsdl/devicemgmt.wsdl', wsse=wsse,transport=None,settings=settings)
    binding = client.wsdl.bindings['{http://www.onvif.org/ver10/device/wsdl}DeviceBinding']
    serviceproxy = ServiceProxy(client, binding, address=xaddr)


    capabilities = serviceproxy.GetCapabilities()
    if capabilities.Extension.DeviceIO == None:
        print ("GetCapabilities failed to parse extension")
        print ("Try removing line with from xs:any namespace=""##other"" from onvif.xsd line 2513 ")
    else:
        print ("GetCapabilities succeeded parsing extension")


if __name__ == '__main__':
    showbug()

ONVIFError: Unknown error: Sender Not Authorized

Dear Mr. FalkTannhaeuser.

Thanks for the great implementation of ONVIF camera. I am currently using your implementation with a SNP-6320H ONVIF compliant camera. As I was trying to run some of your example code, the following error occured:

runfile('C:/Users/Bulut/Desktop/streaming.py', wdir='C:/Users/Bulut/Desktop')
Traceback (most recent call last):

File "", line 1, in
runfile('C:/Users/Bulut/Desktop/streaming.py', wdir='C:/Users/Bulut/Desktop')

File "C:\Users\Bulut\AppData\Local\Continuum\anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 704, in runfile
execfile(filename, namespace)

File "C:\Users\Bulut\AppData\Local\Continuum\anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 108, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)

File "C:/Users/Bulut/Desktop/streaming.py", line 65, in
media_profile_configuration()

File "C:/Users/Bulut/Desktop/streaming.py", line 22, in media_profile_configuration
profiles = media_service.GetProfiles()

File "C:\Users\Bulut\AppData\Local\Continuum\anaconda3\lib\site-packages\onvif_zeep-0.2.12-py3.7.egg\onvif\client.py", line 26, in wrapped
raise ONVIFError(err)

ONVIFError: Unknown error: Sender Not Authorized

Could you please help me with that?
Thanks in advance.

time_params.TimeZone.TZ = 'CST-8:00:00' AttributeError: 'NoneType' object has no attribute 'TZ'

time_params = mycam.devicemgmt.create_type('SetSystemDateAndTime')
time_params.DateTimeType = 'Manual'
time_params.DaylightSavings = True
time_params.TimeZone.TZ = 'CST-8:00:00'

time_params.UTCDateTime.Date.Year = 2014

time_params.UTCDateTime.Date.Month = 12

time_params.UTCDateTime.Date.Day = 3

time_params.UTCDateTime.Time.Hour = 9

time_params.UTCDateTime.Time.Minute = 36

time_params.UTCDateTime.Time.Second = 11

mycam.devicemgmt.SetSystemDateAndTime(time_params)

Traceback (most recent call last):
File "/home/zjx1/tool/pycharm-community-2018.3.5/helpers/pydev/pydevd.py", line 1741, in
main()
File "/home/zjx1/tool/pycharm-community-2018.3.5/helpers/pydev/pydevd.py", line 1735, in main
globals = debugger.run(setup['file'], None, None, is_module)
File "/home/zjx1/tool/pycharm-community-2018.3.5/helpers/pydev/pydevd.py", line 1135, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "/home/zjx1/tool/pycharm-community-2018.3.5/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/home/zjx1/PycharmProjects/zjx_test/camera_test.py", line 27, in
time_params.TimeZone.TZ = 'CST-8:00:00'
AttributeError: 'NoneType' object has no attribute 'TZ'

problem to create continuos_move or any ptz

When I create a continuous move argument for http://www.onvif.org/ver20/ptz/wsdl/ContinuousMove

Input:
[ContinuousMove]
ProfileToken [ReferenceToken]
A reference to the MediaProfile.
Velocity [PTZSpeed]
A Velocity vector specifying the velocity of pan, tilt and zoom.
PanTilt - optional; [Vector2D]
Pan and tilt speed. The x component corresponds to pan and the y component to tilt. If omitted in a request, the current (if any) PanTilt movement should not be affected.
Zoom - optional; [Vector1D]
A zoom speed. If omitted in a request, the current (if any) Zoom movement should not be affected.
Timeout - optional; [duration]
An optional Timeout parameter.

continuous_move = ptz_service.create_type('ContinuousMove')
I only get this for continuous_move :

{
    'ProfileToken': '0',
    'Velocity': None,
    'Timeout': None
}

After I cant move the PTZ because continuous_move doesnt have vector PanTilt , Zoom .

Onvif for python 2 works well

Unknown error: A space is referenced in an argument which is not supported by the PTZ Node.

I try to run continuous_move.py,has some problem ,please help me.
runtime enviorment : python3.6

Use Ctrl-C to quit
Your command: l
move left...
ERROR:asyncio:Exception in callback readin() at examples/continuous_move.py:114
handle: <Handle readin() at examples/continuous_move.py:114>
Traceback (most recent call last):
File "/home/vision/Documents/python-onvif-zeep/onvif/client.py", line 25, in wrapped
return func(*args, **kwargs)
File "/home/vision/Documents/python-onvif-zeep/onvif/client.py", line 150, in wrapped
return call(params, callback)
File "/home/vision/Documents/python-onvif-zeep/onvif/client.py", line 138, in call
ret = func(**params)
File "/usr/local/lib/python3.6/dist-packages/zeep/proxy.py", line 45, in call
kwargs,
File "/usr/local/lib/python3.6/dist-packages/zeep/wsdl/bindings/soap.py", line 130, in send
return self.process_reply(client, operation_obj, response)
File "/usr/local/lib/python3.6/dist-packages/zeep/wsdl/bindings/soap.py", line 195, in process_reply
return self.process_error(doc, operation)
File "/usr/local/lib/python3.6/dist-packages/zeep/wsdl/bindings/soap.py", line 362, in process_error
subcodes=subcodes,
zeep.exceptions.Fault: A space is referenced in an argument which is not supported by the PTZ Node.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3.6/asyncio/events.py", line 145, in _run
self._callback(*self._args)
File "examples/continuous_move.py", line 127, in readin
move_left(ptz,moverequest)
File "examples/continuous_move.py", line 54, in move_left
do_move(ptz, request)
File "examples/continuous_move.py", line 30, in do_move
ptz.ContinuousMove(request)
File "/home/vision/Documents/python-onvif-zeep/onvif/client.py", line 27, in wrapped
raise ONVIFError(err)
onvif.exceptions.ONVIFError: Unknown error: A space is referenced in an argument which is not supported by the PTZ Node.

sqlite3 dependency within zeep causes an error if a cacheless Transport is not specified

I am attempting to use the package as described in the README, e.g. creating an ONVIFCamera instance for later use to access related ONVIF services. My code looks like this:

    camera = ONVIFCamera(host='123.45.6.78',
                         port=80,
                         user='bugs',
                         passwd='bunny',
                         wsdl_dir='..\wsdl')
    result = camera.CreatePullPointSubscription()```

There appears to be a missing sqlite3 module dependency as shown in the below error:

C:\home\miniconda\envs\scw\python.exe "C:\Program Files\JetBrains\PyCharm Community Edition 2018.3.4\helpers\pydev\pydevd.py" --multiproc --qt-support=auto --client 127.0.0.1 --port 57125 --file C:/home/git/onvif_interact/scripts/poll_notifications_pull_point.py
pydev debugger: process 14968 is connecting

Connected to pydev debugger (build 183.5429.31)
Traceback (most recent call last):
  File "C:\home\miniconda\envs\scw\lib\site-packages\onvif\client.py", line 23, in wrapped
    return func(*args, **kwargs)
  File "C:\home\miniconda\envs\scw\lib\site-packages\onvif\client.py", line 102, in __init__
    self.zeep_client = ClientType(wsdl=url, wsse=wsse, transport=transport, settings=settings)
  File "C:\home\miniconda\envs\scw\lib\site-packages\zeep\client.py", line 211, in __init__
    kwargs.get('transport') or Transport(cache=SqliteCache()))
  File "C:\home\miniconda\envs\scw\lib\site-packages\zeep\cache.py", line 67, in __init__
    raise RuntimeError("sqlite3 module is required for the SqliteCache")
RuntimeError: sqlite3 module is required for the SqliteCache

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.3.4\helpers\pydev\pydevd.py", line 1741, in <module>
    main()
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.3.4\helpers\pydev\pydevd.py", line 1735, in main
    globals = debugger.run(setup['file'], None, None, is_module)
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.3.4\helpers\pydev\pydevd.py", line 1135, in run
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.3.4\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "C:/home/git/onvif_interact/scripts/poll_notifications_pull_point.py", line 17, in <module>
    main()
  File "C:/home/git/onvif_interact/scripts/poll_notifications_pull_point.py", line 10, in main
    wsdl_dir='../wsdl')
  File "C:\home\miniconda\envs\scw\lib\site-packages\onvif\client.py", line 216, in __init__
    self.update_xaddrs()
  File "C:\home\miniconda\envs\scw\lib\site-packages\onvif\client.py", line 223, in update_xaddrs
    self.devicemgmt  = self.create_devicemgmt_service()
  File "C:\home\miniconda\envs\scw\lib\site-packages\onvif\client.py", line 333, in create_devicemgmt_service
    return self.create_onvif_service('devicemgmt', from_template)
  File "C:\home\miniconda\envs\scw\lib\site-packages\onvif\client.py", line 321, in create_onvif_service
    transport=self.transport)
  File "C:\home\miniconda\envs\scw\lib\site-packages\onvif\client.py", line 26, in wrapped
    raise ONVIFError(err)
onvif.exceptions.ONVIFError: Unknown error: sqlite3 module is required for the SqliteCache

Process finished with exit code 1

This appears to be caused by the zeep package requiring sqlite3 but not including it in their list of dependencies in setup.py or in a requirements.txt file. From what I can tell they've implemented somewhat of a workaround for this, i.e. you can use a Transport object with no cache, and using this approach will get you past the above error (include transport=Transport(cache=None) in the arguments for the ONVIFCamera instance creation). The root cause is that the zeep code attempts to import sqlite3 and if it's missing then it later croaks if no transport has been specified, since that will trigger an attempt to create an SqliteCache, which is what requires the sqlite3 package.

Assuming the above is correct then the above error is caused by either 1) sqlite3 is not in the environment already, or 2) a cacheless Transport is not specified as the transport argument when instantiating an ONVIFCamera object. I'm not convinced that this is an error per se with either zeep or this package.

Maybe this is best remedied by simply adding a note in the documentation regarding the use of an sqlite database for zeep's caching, or defaulting to using a cacheless Transport when creating an ONVIFCamera object?

If there are other ideas as to the best way forward then please comment (@mvantellingen may advise?) as I may be able to help with a bit of guidance, although I'm completely new to all of this and the above issue report may be all I'm good for here. In any event big thanks for providing this package, as it looks to be very promising for some upcoming work that I'll be doing with ONVIF-compliant devices.

Missing element ForcePersistence (SetVideoEncoderConfiguration.ForcePersistence)

Hi,
I am trying to set the video encoder configurations. I am passing the params as a dictionaries within a list.
but I keep getting this error. I dont know how to add this.


from onvif import ONVIFCamera
mycam = ONVIFCamera('192.168.0.110', 80, 'admin', 'K0mondor', '/home/oasis/Documents/python-onvif-zeep/wsdl/')
import datetime
media_service = mycam.create_media_service()
params = [{
'Name': 'VideoEncoder_1',
'UseCount': 1,
'Encoding': 'H264',
'Resolution': {
'Width': 1920,
'Height': 1080
},
'Quality': 3.0,
'RateControl': {
'FrameRateLimit': 10,
'EncodingInterval': 1,
'BitrateLimit': 4096
},
'MPEG4': None,
'H264': {
'GovLength': 50,
'H264Profile': 'Main'
},
'Multicast': {
'Address': {
'Type': 'IPv4',
'IPv4Address': '0.0.0.0',
'IPv6Address': None
},
'Port': 8860,
'TTL': 128,
'AutoStart': False,
'_value_1': None,
'_attr_1': None
},
'SessionTimeout': datetime.timedelta(0, 5),
'_value_1': None,
'token': 'VideoEncoderToken_1',
'_attr_1': {
}
}, {
'Name': 'VideoEncoder_2',
'UseCount': 1,
'Encoding': 'H264',
'Resolution': {
'Width': 640,
'Height': 360
},
'Quality': 3.0,
'RateControl': {
'FrameRateLimit': 30,
'EncodingInterval': 1,
'BitrateLimit': 768
},
'MPEG4': None,
'H264': {
'GovLength': 50,
'H264Profile': 'Main'
},
'Multicast': {
'Address': {
'Type': 'IPv4',
'IPv4Address': '0.0.0.0',
'IPv6Address': None
},
'Port': 8866,
'TTL': 128,
'AutoStart': False,
'_value_1': None,
'_attr_1': None
},
'SessionTimeout': datetime.timedelta(0, 5),
'_value_1': None,
'token': 'VideoEncoderToken_2',
'_attr_1': {
}
}]

media_service.SetVideoEncoderConfiguration({'Configuration':params},{'ForcePersistence': True})


media_service.SetVideoEncoderConfiguration({'Configuration':params},{'ForcePersistence': True})
Traceback (most recent call last):

File "", line 1, in
media_service.SetVideoEncoderConfiguration({'Configuration':params},{'ForcePersistence': True})

File "/home/oasis/anaconda3/lib/python3.6/site-packages/onvif/client.py", line 28, in wrapped
raise ONVIFError(err)

ONVIFError: Unknown error: Missing element ForcePersistence (SetVideoEncoderConfiguration.ForcePersistence)

I dont know how to add this 'ForcePersistence'.

Support async zeep / allow services transport override

It looks like this lib doesn't support async out of the box. Whenever I define a custom transport:

loop = asyncio.get_event_loop()
transport = AsyncTransport(loop, cache=None)

self._camera = ONVIFCamera(self._host,
                           self._port,
                           self._username,
                           self._password,
                           '{}/wsdl/'
                           .format(os.path.dirname(onvif.__file__)),
                           transport=transport)

I get an error:

  File "/config/custom_components/onvif/camera.py", line 155, in __init__
    transport=transport)
  File "/config/deps/lib/python3.7/site-packages/onvif/client.py", line 216, in __init__
    self.update_xaddrs()
  File "/config/deps/lib/python3.7/site-packages/onvif/client.py", line 234, in update_xaddrs
    for name in capabilities:
TypeError: 'coroutine' object is not iterable

There are a few things that could be done here:

  1. Always check whether a service call is async or not (lots of work)
  2. Allow transport override for the services (in create_onvif_service, see https://github.com/FalkTannhaeuser/python-onvif-zeep/blob/zeep/onvif/client.py#L308)

In the 2nd case, it can be kept simple because you can keep "force-using" the sync stuff on the internals (e.g. to get the attributes, etc), but end-users could decide to override the transport for custom created services and use this library async.

If you are open to this, and you are able to deploy this in a timely manner, I am happy to contribute.

GetProfiles() fails with a XML stack trace

A simple script to get the media profiles like this:

#!/usr/bin/env python3

from onvif import ONVIFCamera
mycam = ONVIFCamera('10.23.67.76', 8899, 'admin', '', './wsdl/')

media = mycam.create_media_service()
resp = media.GetProfiles();
print("Video is " + str(resp))

Fails with what appears to be a XML parsing trace:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/onvif_zeep-0.2.11-py3.6.egg/onvif/client.py", line 24, in wrapped
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/onvif_zeep-0.2.11-py3.6.egg/onvif/client.py", line 183, in wrapped
    return call(params, callback)
  File "/usr/local/lib/python3.6/dist-packages/onvif_zeep-0.2.11-py3.6.egg/onvif/client.py", line 170, in call
    ret = func(**params)
  File "/usr/local/lib/python3.6/dist-packages/zeep/proxy.py", line 42, in __call__
    self._op_name, args, kwargs)
  File "/usr/local/lib/python3.6/dist-packages/zeep/wsdl/bindings/soap.py", line 126, in send
    return self.process_reply(client, operation_obj, response)
  File "/usr/local/lib/python3.6/dist-packages/zeep/wsdl/bindings/soap.py", line 190, in process_reply
    result = operation.process_reply(doc)
  File "/usr/local/lib/python3.6/dist-packages/zeep/wsdl/bindings/soap.py", line 371, in process_reply
    return self.output.deserialize(envelope)
  File "/usr/local/lib/python3.6/dist-packages/zeep/wsdl/messages/soap.py", line 91, in deserialize
    body_result = self._deserialize_body(body)
  File "/usr/local/lib/python3.6/dist-packages/zeep/wsdl/messages/soap.py", line 413, in _deserialize_body
    result = self.body.parse(xmlelement, self.wsdl.types, context=context)
  File "/usr/local/lib/python3.6/dist-packages/zeep/xsd/elements/element.py", line 114, in parse
    schema_type=self.type)
  File "/usr/local/lib/python3.6/dist-packages/zeep/xsd/types/complex.py", line 169, in parse_xmlelement
    elements, schema, name, context=context)
  File "/usr/local/lib/python3.6/dist-packages/zeep/xsd/elements/indicators.py", line 600, in parse_xmlelements
    xmlelements, schema, name, context=context)
  File "/usr/local/lib/python3.6/dist-packages/zeep/xsd/elements/element.py", line 160, in parse_xmlelements
    xmlelement, schema, allow_none=True, context=context)
  File "/usr/local/lib/python3.6/dist-packages/zeep/xsd/elements/element.py", line 114, in parse
    schema_type=self.type)
  File "/usr/local/lib/python3.6/dist-packages/zeep/xsd/types/complex.py", line 169, in parse_xmlelement
    elements, schema, name, context=context)
  File "/usr/local/lib/python3.6/dist-packages/zeep/xsd/elements/indicators.py", line 600, in parse_xmlelements
    xmlelements, schema, name, context=context)
  File "/usr/local/lib/python3.6/dist-packages/zeep/xsd/elements/element.py", line 160, in parse_xmlelements
    xmlelement, schema, allow_none=True, context=context)
  File "/usr/local/lib/python3.6/dist-packages/zeep/xsd/elements/element.py", line 114, in parse
    schema_type=self.type)
  File "/usr/local/lib/python3.6/dist-packages/zeep/xsd/types/complex.py", line 169, in parse_xmlelement
    elements, schema, name, context=context)
  File "/usr/local/lib/python3.6/dist-packages/zeep/xsd/elements/indicators.py", line 600, in parse_xmlelements
    xmlelements, schema, name, context=context)
  File "/usr/local/lib/python3.6/dist-packages/zeep/xsd/elements/element.py", line 160, in parse_xmlelements
    xmlelement, schema, allow_none=True, context=context)
  File "/usr/local/lib/python3.6/dist-packages/zeep/xsd/elements/element.py", line 114, in parse
    schema_type=self.type)
  File "/usr/local/lib/python3.6/dist-packages/zeep/xsd/types/complex.py", line 169, in parse_xmlelement
    elements, schema, name, context=context)
  File "/usr/local/lib/python3.6/dist-packages/zeep/xsd/elements/indicators.py", line 600, in parse_xmlelements
    xmlelements, schema, name, context=context)
  File "/usr/local/lib/python3.6/dist-packages/zeep/xsd/elements/element.py", line 160, in parse_xmlelements
    xmlelement, schema, allow_none=True, context=context)
  File "/usr/local/lib/python3.6/dist-packages/zeep/xsd/elements/element.py", line 114, in parse
    schema_type=self.type)
  File "/usr/local/lib/python3.6/dist-packages/zeep/xsd/types/complex.py", line 169, in parse_xmlelement
    elements, schema, name, context=context)
  File "/usr/local/lib/python3.6/dist-packages/zeep/xsd/elements/indicators.py", line 600, in parse_xmlelements
    xmlelements, schema, name, context=context)
  File "/usr/local/lib/python3.6/dist-packages/zeep/xsd/elements/element.py", line 160, in parse_xmlelements
    xmlelement, schema, allow_none=True, context=context)
  File "/usr/local/lib/python3.6/dist-packages/zeep/xsd/elements/element.py", line 114, in parse
    schema_type=self.type)
  File "/usr/local/lib/python3.6/dist-packages/zeep/xsd/types/complex.py", line 169, in parse_xmlelement
    elements, schema, name, context=context)
  File "/usr/local/lib/python3.6/dist-packages/zeep/xsd/elements/indicators.py", line 600, in parse_xmlelements
    xmlelements, schema, name, context=context)
  File "/usr/local/lib/python3.6/dist-packages/zeep/xsd/elements/element.py", line 160, in parse_xmlelements
    xmlelement, schema, allow_none=True, context=context)
  File "/usr/local/lib/python3.6/dist-packages/zeep/xsd/elements/element.py", line 114, in parse
    schema_type=self.type)
  File "/usr/local/lib/python3.6/dist-packages/zeep/xsd/types/complex.py", line 189, in parse_xmlelement
    init_kwargs[name] = attribute.parse(value)
  File "/usr/local/lib/python3.6/dist-packages/zeep/xsd/elements/attribute.py", line 22, in parse
    return self.type.pythonvalue(value)
  File "/usr/local/lib/python3.6/dist-packages/zeep/xsd/types/simple.py", line 68, in pythonvalue
    '%s.pytonvalue() not implemented' % self.__class__.__name__)
NotImplementedError: AnySimpleType.pytonvalue() not implemented

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./set_onvif", line 7, in <module>
    resp = media.GetProfiles();
  File "/usr/local/lib/python3.6/dist-packages/onvif_zeep-0.2.11-py3.6.egg/onvif/client.py", line 28, in wrapped
    raise ONVIFError(err)
onvif.exceptions.ONVIFError: Unknown error: AnySimpleType.pytonvalue() not implemented

Error on function: GetStreamUri, No Namespace defined for 'ter' ('ter:InvalidArgVal')

Hello Guys I get this error when I try to run the function GetStreamUri:

  File "/usr/local/lib/python3.5/dist-packages/onvif_zeep-0.2.12-py3.5.egg/onvif/client.py", line 23, in wrapped
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/onvif_zeep-0.2.12-py3.5.egg/onvif/client.py", line 153, in wrapped
    return call(params, callback)
  File "/usr/local/lib/python3.5/dist-packages/onvif_zeep-0.2.12-py3.5.egg/onvif/client.py", line 140, in call
    ret = func(**params)
  File "/usr/local/lib/python3.5/dist-packages/zeep-3.1.0-py3.5.egg/zeep/proxy.py", line 42, in __call__
    self._op_name, args, kwargs)
  File "/usr/local/lib/python3.5/dist-packages/zeep-3.1.0-py3.5.egg/zeep/wsdl/bindings/soap.py", line 132, in send
    return self.process_reply(client, operation_obj, response)
  File "/usr/local/lib/python3.5/dist-packages/zeep-3.1.0-py3.5.egg/zeep/wsdl/bindings/soap.py", line 194, in process_reply
    return self.process_error(doc, operation)
  File "/usr/local/lib/python3.5/dist-packages/zeep-3.1.0-py3.5.egg/zeep/wsdl/bindings/soap.py", line 338, in process_error
    subcode_qname = as_qname(subcode_value_element.text, subcode_value_element.nsmap, None)
  File "/usr/local/lib/python3.5/dist-packages/zeep-3.1.0-py3.5.egg/zeep/utils.py", line 31, in as_qname
    "No namespace defined for %r (%r)" % (prefix, value))
zeep.exceptions.XMLParseError: No namespace defined for 'ter' ('ter:InvalidArgVal')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "testcam.py", line 32, in <module>
    print(media_service.GetStreamUri(obj))
  File "/usr/local/lib/python3.5/dist-packages/onvif_zeep-0.2.12-py3.5.egg/onvif/client.py", line 26, in wrapped
    raise ONVIFError(err)
onvif.exceptions.ONVIFError: Unknown error: No namespace defined for 'ter' ('ter:InvalidArgVal')

Here is the funtion I am running:

from onvif import ONVIFCamera, ONVIFService

 mycam = ONVIFCamera('192.168.0.112', 80, 'admin', '12345')
 media_service = mycam.create_media_service()
 profiles = media_service.GetProfiles()
 token = profiles[0].token         // using attribute '_token' returns and error so I am using atribute 'token'

obj = media_service.create_type('GetStreamUri')
obj.ProfileToken = token
obj.StreamSetup = {'Stream': 'RTP-Unicast', 'Transport': {'Protocol': 'RTSP'}}
print(media_service.GetStreamUri(obj))

The error occurs on the funtion:
##obj = media_service.create_type('GetStreamUri')

I have tried installing using pip3 and I have also tried installing from the github repo. I have also checkout different versions of the github repo, but all give the same error.

Any help will be appreciated, thanks,

README.rst sample codes problems

First Thanks for sharing codes.I try on run samples of your codes and I got errors so I was disappoint from your code but after reading zeep document I found errors on your code as you can see below

In Type Instance section , Hostname is wrong attribute name.

params = mycam.devicemgmt.create_type('SetHostname')
params.Hostname = 'NewHostName'
mycam.devicemgmt.SetHostname(params)

must be

params = mycam.devicemgmt.create_type('SetHostname')
params.Name = 'NewHostName'
mycam.devicemgmt.SetHostname(params)

In Use other services section ,GetConfiguration() need some parameter so raise an error.

ptz_service = mycam.create_ptz_service()
mycam.ptz.GetConfiguration()

must be

ptz_service = mycam.create_ptz_service()
ptz_service.GetConfigurations()

ERROR:onvif:Unexcept service type

Hello,

After install thanks to

pip install --upgrade https://github.com/FalkTannhaeuser/python-onvif-zeep/archive/zeep.zip

I try to use your project but i get an error when i instantiate ONVIFCamera.

mycam = ONVIFCamera('ip', port, 'user', 'pass', '/path/to/wsdl/')
ERROR:onvif:Unexcept service type
Traceback (most recent call last):
  File "/path/lib/python3.4/site-packages/onvif/client.py", line 266, in update_xaddrs
    self.xaddrs[ns] = capability['XAddr']
TypeError: 'NoneType' object is not subscriptable

Regards

Error connecting to ip camera

I'm unable to talk with my ip camera using the CLI tool of python-onvif-zeep:

$ python3 onvif/cli.py -u 'admin' -a 'pwd' --host '192.168.1.10' --port 5000
ONVIF >>> cmd devicemgmt GetWsdlUrl
False: Unknown error: ('Connection aborted.', BadStatusLine("''",))
ONVIF >>> cmd devicemgmt GetHostname
False: Unknown error: ('Connection aborted.', BadStatusLine("''",))

Please note that at the moment of this test, the ip camera was working, was sending its video stream to its Android app and was accepting PTZ commands from it.

The ip camera used for this test is a Sricam SP017:

http://www.sricam.com/product/id/43125fd002d2427aae38f00420679b24.html

I'm able to use this small and cheap camera as a ONVIF-compliant camera using Onvifer on Android so it seems to be somehow compliant with the ONVIF standard.

Does anybody have any idea about the possible source of this error?

BTW: I tried to install python-onvif-zeep both cloning its GIT repository and installing it with PIP on my Linux Mint 17.1 with Python 2.7 and Python 3.4. In both cases, if I follow the instructions contained in the README, it does not work. I have to launch the cli.py in the way you can see in the example above to access the CLI interface.

from: can't read /var/mail/onvif

When i try to run this command,

from onvif import ONVIFCamera

Im getting the below error message
from: can't read /var/mail/onvif

How can i resolve this

lxml.etree.XMLSyntaxError: Document is empty, line 1, column 1

I am getting the following exception when I try to run streaming.py. I get this exception for any example or test code I try.

Traceback (most recent call last):
  File "/home/enigma/codes/python/virtualEnvironment/env/lib/python3.6/site-packages/zeep/loader.py", line 50, in parse_xml
    forbid_entities=settings.forbid_entities)
  File "/home/enigma/codes/python/virtualEnvironment/env/lib/python3.6/site-packages/defusedxml/lxml.py", line 143, in fromstring
    rootelement = _etree.fromstring(text, parser, base_url=base_url)
  File "src/lxml/etree.pyx", line 3213, in lxml.etree.fromstring
  File "src/lxml/parser.pxi", line 1877, in lxml.etree._parseMemoryDocument
  File "src/lxml/parser.pxi", line 1765, in lxml.etree._parseDoc
  File "src/lxml/parser.pxi", line 1127, in lxml.etree._BaseParser._parseDoc
  File "src/lxml/parser.pxi", line 601, in lxml.etree._ParserContext._handleParseResultDoc
  File "src/lxml/parser.pxi", line 711, in lxml.etree._handleParseResult
  File "src/lxml/parser.pxi", line 640, in lxml.etree._raiseParseError
  File "<string>", line 1
lxml.etree.XMLSyntaxError: Document is empty, line 1, column 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/enigma/codes/python/virtualEnvironment/env/lib/python3.6/site-packages/zeep/wsdl/bindings/soap.py", line 170, in process_reply
    doc = parse_xml(content, self.transport, settings=client.settings)
  File "/home/enigma/codes/python/virtualEnvironment/env/lib/python3.6/site-packages/zeep/loader.py", line 54, in parse_xml
    content=content
zeep.exceptions.XMLSyntaxError: Invalid XML content received (Document is empty, line 1, column 1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/enigma/codes/python/virtualEnvironment/env/lib/python3.6/site-packages/onvif_zeep-0.2.12-py3.6.egg/onvif/client.py", line 23, in wrapped
    return func(*args, **kwargs)
  File "/home/enigma/codes/python/virtualEnvironment/env/lib/python3.6/site-packages/onvif_zeep-0.2.12-py3.6.egg/onvif/client.py", line 153, in wrapped
    return call(params, callback)
  File "/home/enigma/codes/python/virtualEnvironment/env/lib/python3.6/site-packages/onvif_zeep-0.2.12-py3.6.egg/onvif/client.py", line 140, in call
    ret = func(**params)
  File "/home/enigma/codes/python/virtualEnvironment/env/lib/python3.6/site-packages/zeep/proxy.py", line 42, in __call__
    self._op_name, args, kwargs)
  File "/home/enigma/codes/python/virtualEnvironment/env/lib/python3.6/site-packages/zeep/wsdl/bindings/soap.py", line 132, in send
    return self.process_reply(client, operation_obj, response)
  File "/home/enigma/codes/python/virtualEnvironment/env/lib/python3.6/site-packages/zeep/wsdl/bindings/soap.py", line 176, in process_reply
    content=response.content)
zeep.exceptions.TransportError: Server returned response (200) with invalid XML: Invalid XML content received (Document is empty, line 1, column 1).
Content: b''

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "streaming.py", line 58, in <module>
    media_profile_configuration()
  File "streaming.py", line 12, in media_profile_configuration
    mycam = ONVIFCamera('192.168.1.52', 80, 'admin', 'admin')
  File "/home/enigma/codes/python/virtualEnvironment/env/lib/python3.6/site-packages/onvif_zeep-0.2.12-py3.6.egg/onvif/client.py", line 216, in __init__
    self.update_xaddrs()
  File "/home/enigma/codes/python/virtualEnvironment/env/lib/python3.6/site-packages/onvif_zeep-0.2.12-py3.6.egg/onvif/client.py", line 233, in update_xaddrs
    capabilities = self.devicemgmt.GetCapabilities({'Category': 'All'})
  File "/home/enigma/codes/python/virtualEnvironment/env/lib/python3.6/site-packages/onvif_zeep-0.2.12-py3.6.egg/onvif/client.py", line 26, in wrapped
    raise ONVIFError(err)
onvif.exceptions.ONVIFError: Unknown error: Server returned response (200) with invalid XML: Invalid XML content received (Document is empty, line 1, column 1).
Content: b''

when to add onvif 2.*?

New version adds support for new features and also simplifies the use of features that already exist. Version 2 is already on many devices, but there are no libraries supporting version 2

ter:ActionNotSupported

Hello, I have your framework to run the camera, but every time I am prompted with this error, I am not very familiar with the onvif protocol, can you help me with the prompt?

image

Can't install module by setup.py

The latest code I downloaded can't be installed by setup.py and I would like to fix this issue but has no idea what it happened. Could you give any advice?

C:\python-onvif-zeep-zeep>py -3 -m setup.py install
running install
running bdist_egg
running egg_info
writing onvif_zeep.egg-info\PKG-INFO
writing dependency_links to onvif_zeep.egg-info\dependency_links.txt
writing entry points to onvif_zeep.egg-info\entry_points.txt
writing requirements to onvif_zeep.egg-info\requires.txt
writing top-level names to onvif_zeep.egg-info\top_level.txt
reading manifest file 'onvif_zeep.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'README.'
writing manifest file 'onvif_zeep.egg-info\SOURCES.txt'
installing library code to build\bdist.win32\egg
running install_lib
running build_py
creating build\bdist.win32\egg
creating build\bdist.win32\egg\onvif
copying build\lib\onvif\cli.py -> build\bdist.win32\egg\onvif
copying build\lib\onvif\client.py -> build\bdist.win32\egg\onvif
copying build\lib\onvif\definition.py -> build\bdist.win32\egg\onvif
copying build\lib\onvif\exceptions.py -> build\bdist.win32\egg\onvif
copying build\lib\onvif\version.txt -> build\bdist.win32\egg\onvif
copying build\lib\onvif_init_.py -> build\bdist.win32\egg\onvif
byte-compiling build\bdist.win32\egg\onvif\cli.py to cli.cpython-37.pyc
byte-compiling build\bdist.win32\egg\onvif\client.py to client.cpython-37.pyc
byte-compiling build\bdist.win32\egg\onvif\definition.py to definition.cpython-37.pyc
byte-compiling build\bdist.win32\egg\onvif\exceptions.py to exceptions.cpython-37.pyc
byte-compiling build\bdist.win32\egg\onvif_init_.py to init.cpython-37.pyc
installing package data to build\bdist.win32\egg
running install_data
creating build\bdist.win32\egg\Lib
creating build\bdist.win32\egg\Lib\site-packages
creating build\bdist.win32\egg\Lib\site-packages\wsdl
copying wsdl\accesscontrol.wsdl -> build\bdist.win32\egg\Lib\site-packages\wsdl
copying wsdl\actionengine.wsdl -> build\bdist.win32\egg\Lib\site-packages\wsdl
copying wsdl\addressing -> build\bdist.win32\egg\Lib\site-packages\wsdl
copying wsdl\advancedsecurity.wsdl -> build\bdist.win32\egg\Lib\site-packages\wsdl
copying wsdl\analytics.wsdl -> build\bdist.win32\egg\Lib\site-packages\wsdl
copying wsdl\analyticsdevice.wsdl -> build\bdist.win32\egg\Lib\site-packages\wsdl
copying wsdl\b-2.xsd -> build\bdist.win32\egg\Lib\site-packages\wsdl
copying wsdl\bf-2.xsd -> build\bdist.win32\egg\Lib\site-packages\wsdl
copying wsdl\bw-2.wsdl -> build\bdist.win32\egg\Lib\site-packages\wsdl
copying wsdl\deviceio.wsdl -> build\bdist.win32\egg\Lib\site-packages\wsdl
copying wsdl\devicemgmt.wsdl -> build\bdist.win32\egg\Lib\site-packages\wsdl
copying wsdl\display.wsdl -> build\bdist.win32\egg\Lib\site-packages\wsdl
copying wsdl\doorcontrol.wsdl -> build\bdist.win32\egg\Lib\site-packages\wsdl
copying wsdl\envelope -> build\bdist.win32\egg\Lib\site-packages\wsdl
copying wsdl\events.wsdl -> build\bdist.win32\egg\Lib\site-packages\wsdl
copying wsdl\imaging.wsdl -> build\bdist.win32\egg\Lib\site-packages\wsdl
copying wsdl\include -> build\bdist.win32\egg\Lib\site-packages\wsdl
copying wsdl\media.wsdl -> build\bdist.win32\egg\Lib\site-packages\wsdl
copying wsdl\onvif.xsd -> build\bdist.win32\egg\Lib\site-packages\wsdl
copying wsdl\ptz.wsdl -> build\bdist.win32\egg\Lib\site-packages\wsdl
copying wsdl\r-2.xsd -> build\bdist.win32\egg\Lib\site-packages\wsdl
copying wsdl\receiver.wsdl -> build\bdist.win32\egg\Lib\site-packages\wsdl
copying wsdl\recording.wsdl -> build\bdist.win32\egg\Lib\site-packages\wsdl
copying wsdl\remotediscovery.wsdl -> build\bdist.win32\egg\Lib\site-packages\wsdl
copying wsdl\replay.wsdl -> build\bdist.win32\egg\Lib\site-packages\wsdl
copying wsdl\rw-2.wsdl -> build\bdist.win32\egg\Lib\site-packages\wsdl
copying wsdl\search.wsdl -> build\bdist.win32\egg\Lib\site-packages\wsdl
copying wsdl\t-1.xsd -> build\bdist.win32\egg\Lib\site-packages\wsdl
copying wsdl\types.xsd -> build\bdist.win32\egg\Lib\site-packages\wsdl
copying wsdl\ws-addr.xsd -> build\bdist.win32\egg\Lib\site-packages\wsdl
copying wsdl\ws-discovery.xsd -> build\bdist.win32\egg\Lib\site-packages\wsdl
copying wsdl\xml.xsd -> build\bdist.win32\egg\Lib\site-packages\wsdl
copying wsdl\xmlmime -> build\bdist.win32\egg\Lib\site-packages\wsdl
creating build\bdist.win32\egg\EGG-INFO
copying onvif_zeep.egg-info\PKG-INFO -> build\bdist.win32\egg\EGG-INFO
copying onvif_zeep.egg-info\SOURCES.txt -> build\bdist.win32\egg\EGG-INFO
copying onvif_zeep.egg-info\dependency_links.txt -> build\bdist.win32\egg\EGG-INFO
copying onvif_zeep.egg-info\entry_points.txt -> build\bdist.win32\egg\EGG-INFO
copying onvif_zeep.egg-info\not-zip-safe -> build\bdist.win32\egg\EGG-INFO
copying onvif_zeep.egg-info\requires.txt -> build\bdist.win32\egg\EGG-INFO
copying onvif_zeep.egg-info\top_level.txt -> build\bdist.win32\egg\EGG-INFO
creating 'dist\onvif_zeep-0.2.12-py3.7.egg' and adding 'build\bdist.win32\egg' to it
removing 'build\bdist.win32\egg' (and everything under it)
Processing onvif_zeep-0.2.12-py3.7.egg
removing 'c:\python37-32\lib\site-packages\onvif_zeep-0.2.12-py3.7.egg' (and everything under it)
creating c:\python37-32\lib\site-packages\onvif_zeep-0.2.12-py3.7.egg
Extracting onvif_zeep-0.2.12-py3.7.egg to c:\python37-32\lib\site-packages
onvif-zeep 0.2.12 is already the active version in easy-install.pth
Installing onvif-cli-script.py script to C:\Python37-32\Scripts
Installing onvif-cli.exe script to C:\Python37-32\Scripts
Installing onvif-cli.exe.manifest script to C:\Python37-32\Scripts

Installed c:\python37-32\lib\site-packages\onvif_zeep-0.2.12-py3.7.egg
Processing dependencies for onvif-zeep==0.2.12
Searching for zeep==3.4.0
Best match: zeep 3.4.0
Adding zeep 3.4.0 to easy-install.pth file

Using c:\python37-32\lib\site-packages
Searching for requests-toolbelt==0.9.1
Best match: requests-toolbelt 0.9.1
Adding requests-toolbelt 0.9.1 to easy-install.pth file

Using c:\python37-32\lib\site-packages
Searching for attrs==19.1.0
Best match: attrs 19.1.0
Adding attrs 19.1.0 to easy-install.pth file

Using c:\python37-32\lib\site-packages
Searching for cached-property==1.5.1
Best match: cached-property 1.5.1
Adding cached-property 1.5.1 to easy-install.pth file

Using c:\python37-32\lib\site-packages
Searching for isodate==0.6.0
Best match: isodate 0.6.0
Adding isodate 0.6.0 to easy-install.pth file

Using c:\python37-32\lib\site-packages
Searching for defusedxml==0.6.0
Best match: defusedxml 0.6.0
Adding defusedxml 0.6.0 to easy-install.pth file

Using c:\python37-32\lib\site-packages
Searching for pytz==2019.1
Best match: pytz 2019.1
Adding pytz 2019.1 to easy-install.pth file

Using c:\python37-32\lib\site-packages
Searching for requests==2.22.0
Best match: requests 2.22.0
Adding requests 2.22.0 to easy-install.pth file

Using c:\python37-32\lib\site-packages
Searching for lxml==4.3.4
Best match: lxml 4.3.4
Adding lxml 4.3.4 to easy-install.pth file

Using c:\python37-32\lib\site-packages
Searching for six==1.12.0
Best match: six 1.12.0
Adding six 1.12.0 to easy-install.pth file

Using c:\users\jwu\appdata\roaming\python\python37\site-packages
Searching for appdirs==1.4.3
Best match: appdirs 1.4.3
Adding appdirs 1.4.3 to easy-install.pth file

Using c:\python37-32\lib\site-packages
Searching for chardet==3.0.4
Best match: chardet 3.0.4
Adding chardet 3.0.4 to easy-install.pth file
Installing chardetect-script.py script to C:\Python37-32\Scripts
Installing chardetect.exe script to C:\Python37-32\Scripts
Installing chardetect.exe.manifest script to C:\Python37-32\Scripts

Using c:\python37-32\lib\site-packages
Searching for urllib3==1.25.3
Best match: urllib3 1.25.3
Adding urllib3 1.25.3 to easy-install.pth file

Using c:\python37-32\lib\site-packages
Searching for certifi==2019.3.9
Best match: certifi 2019.3.9
Adding certifi 2019.3.9 to easy-install.pth file

Using c:\python37-32\lib\site-packages
Searching for idna==2.8
Best match: idna 2.8
Adding idna 2.8 to easy-install.pth file

Using c:\python37-32\lib\site-packages
Finished processing dependencies for onvif-zeep==0.2.12
C:\Python37-32\python.exe: Error while finding module specification for 'setup.py' (ModuleNotFoundError: path attrib
ute not found on 'setup' while trying to find 'setup.py')

ONVIFError: Unknown error: Missing element ForcePersistence

Hi )
This is code:
forcePersistence = False
ptz_service.SetConfiguration(ptzConfiguration, forcePersistence)

...and I get the mistake in header (((

PS. Debug printing -
Ouuups: err = Missing element ForcePersistence (SetConfiguration.ForcePersistence) , func = <function ONVIFService.service_wrapper..wrapped at 0x7fa09265f0d0> , args = ({
....MyConfiguration...
}, False
) , kwargs = {}
Both elements (Conf+ForcePersistence) ARE in function input... Why MISSING????

How to judge the onvif camera is still online?

Hello,
I want create a application to managing some cameras , and i found a problem when i running the application :
if a online camera has disconnected, and i still use this camera reference to visit the camera mycam.media_service.GetProfiles() , the return value is nothing ( not 'None' ) ,my code will stopping execute and skipping the following code ( no errors )
can you help me ?

Error with GetSreamUri Function: No namespace defined for 'ter'

Hello Guys I get this error when I try to run the function GetStreamUri:

  File "/usr/local/lib/python3.5/dist-packages/onvif_zeep-0.2.12-py3.5.egg/onvif/client.py", line 23, in wrapped
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/onvif_zeep-0.2.12-py3.5.egg/onvif/client.py", line 153, in wrapped
    return call(params, callback)
  File "/usr/local/lib/python3.5/dist-packages/onvif_zeep-0.2.12-py3.5.egg/onvif/client.py", line 140, in call
    ret = func(**params)
  File "/usr/local/lib/python3.5/dist-packages/zeep-3.1.0-py3.5.egg/zeep/proxy.py", line 42, in __call__
    self._op_name, args, kwargs)
  File "/usr/local/lib/python3.5/dist-packages/zeep-3.1.0-py3.5.egg/zeep/wsdl/bindings/soap.py", line 132, in send
    return self.process_reply(client, operation_obj, response)
  File "/usr/local/lib/python3.5/dist-packages/zeep-3.1.0-py3.5.egg/zeep/wsdl/bindings/soap.py", line 194, in process_reply
    return self.process_error(doc, operation)
  File "/usr/local/lib/python3.5/dist-packages/zeep-3.1.0-py3.5.egg/zeep/wsdl/bindings/soap.py", line 338, in process_error
    subcode_qname = as_qname(subcode_value_element.text, subcode_value_element.nsmap, None)
  File "/usr/local/lib/python3.5/dist-packages/zeep-3.1.0-py3.5.egg/zeep/utils.py", line 31, in as_qname
    "No namespace defined for %r (%r)" % (prefix, value))
zeep.exceptions.XMLParseError: No namespace defined for 'ter' ('ter:InvalidArgVal')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "testcam.py", line 32, in <module>
    print(media_service.GetStreamUri(obj))
  File "/usr/local/lib/python3.5/dist-packages/onvif_zeep-0.2.12-py3.5.egg/onvif/client.py", line 26, in wrapped
    raise ONVIFError(err)
onvif.exceptions.ONVIFError: Unknown error: No namespace defined for 'ter' ('ter:InvalidArgVal')

Here is the funtion I am running:

from onvif import ONVIFCamera, ONVIFService

 mycam = ONVIFCamera('192.168.0.112', 80, 'admin', '12345')
 media_service = mycam.create_media_service()
 profiles = media_service.GetProfiles()
 token = profiles[0].token         // using attribute '_token' returns and error so I am using atribute 'token'

obj = media_service.create_type('GetStreamUri')
obj.ProfileToken = token
obj.StreamSetup = {'Stream': 'RTP-Unicast', 'Transport': {'Protocol': 'RTSP'}}
print(media_service.GetStreamUri(obj))

The error occurs on the funtion:
##obj = media_service.create_type('GetStreamUri')

I have tried installing using pip3 and I have also tried installing from the github repo. I have also checkout different versions of the github repo, but all give the same error.

Any help will be appreciated, thanks,
@FalkTannhaeuser
@sinchb
@iomihai
@mpromonet
@eLvErDe

Events example not working

I have tried the events.py example, but I am getting the following error:

Traceback (most recent call last):
File "/usr/lib/python3.5/site-packages/zeep-2.4.0-py3.5.egg/zeep/xsd/schema.py", line 499, in _get_instance
return items[qname]
KeyError: <lxml.etree.QName object at 0x7ff1bda46940>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "events.py", line 12, in
req = pullpoint.create_type('PullMessages')
File "/usr/lib/python3.5/site-packages/onvif_zeep-0.2.7-py3.5.egg/onvif/client.py", line 120, in
self.create_type = lambda x: self.zeep_client.get_element('ns0:' + x)()
File "/usr/lib/python3.5/site-packages/zeep-2.4.0-py3.5.egg/zeep/client.py", line 256, in get_element
return self.wsdl.types.get_element(name)
File "/usr/lib/python3.5/site-packages/zeep-2.4.0-py3.5.egg/zeep/xsd/schema.py", line 136, in get_element
return self._get_instance(qname, 'get_element', 'element')
File "/usr/lib/python3.5/site-packages/zeep-2.4.0-py3.5.egg/zeep/xsd/schema.py", line 244, in _get_instance
raise last_exception
File "/usr/lib/python3.5/site-packages/zeep-2.4.0-py3.5.egg/zeep/xsd/schema.py", line 240, in _get_instance
return method(qname)
File "/usr/lib/python3.5/site-packages/zeep-2.4.0-py3.5.egg/zeep/xsd/schema.py", line 471, in get_element
return self._get_instance(qname, self._elements, 'element')
File "/usr/lib/python3.5/site-packages/zeep-2.4.0-py3.5.egg/zeep/xsd/schema.py", line 514, in _get_instance
location=self._location)
zeep.exceptions.LookupError: No element 'PullMessages' in namespace http://docs.oasis-open.org/wsrf/rw-2. Available elements are: -

I googled around but I cannot find any solution.

Inaccurate documentation

The section in the README related to creating an unofficial service is not accurate.

The documentation shows that create_onvif_service should be called with a WSDL location, xaddr, and service name as arguments. The actual arguments for this function are the (service) name, from_template (unused), and portType.

Another aspect is that the create_onvif_service function can't be used as described to just create a service willy-nilly, but instead the service needs to be defined in the SERVICES dictionary declared within definition.py otherwise, an ONVIFError is raised within client.py.

Instead, it seems that what is necessary for a new service is to add an entry into the SERVICES dictionary declared within definition.py as well as a corresponding create_<name>_service function within the ONVIFCamera class within client.py.

Can't connect to camera over NAT

This code is correctly executed on the client on the same subnet as the camera:
mycam = ONVIFCamera('192.168.0.105', 8999, 'admin', 'password', 'wsdl/')
ptz_service = mycam.create_ptz_service()
ptz_conf = ptz_service.GetConfigurations()
But this does not work when I try to connect through a router with a configured port forwarding. create_ptz_service returns object contained local camera network address, and i can't connect to camera using this address. Trying to change xaddr is no effect.

Add service for NotificationProducerBinding

In order to create a subscription for notification events, (I think) I need to issue a request to NotificationProducer.Subscribe.

I propose to add a new notification service in definition.py as well as a corresponding ONVIFCamera.create_notification_service function within client.py

The above will allow for something like this:

    # get the notification service we'll use for access to camera notifications
    notification_service = camera.get_service("notification")

    # subscribe for notification events
    args = {"InitialTerminationTime": "PT10M",
            "Address": f"{_LOCAL_IP_ADDRESS}:{_LISTENER_PORT}"}
    notification_service.Subscribe(args)

onvif.exceptions.ONVIFError: Unknown error: super() takes at least 1 argument (0 given)

Hi, when installed onvif_zeep sucessfully, I ran the following code, but it throws ONVIFError:

>>> from onvif import ONVIFCamera
>>> mycam = ONVIFCamera('192.168.1.65', 80, 'admin', 'password', '/etc/onvif/wsdl/')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/onvif_zeep-0.2.12-py2.7.egg/onvif/client.py", line 216, in __init__
    self.update_xaddrs()
  File "/usr/local/lib/python2.7/dist-packages/onvif_zeep-0.2.12-py2.7.egg/onvif/client.py", line 223, in update_xaddrs
    self.devicemgmt  = self.create_devicemgmt_service()
  File "/usr/local/lib/python2.7/dist-packages/onvif_zeep-0.2.12-py2.7.egg/onvif/client.py", line 333, in create_devicemgmt_service
    return self.create_onvif_service('devicemgmt', from_template)
  File "/usr/local/lib/python2.7/dist-packages/onvif_zeep-0.2.12-py2.7.egg/onvif/client.py", line 321, in create_onvif_service
    transport=self.transport)
  File "/usr/local/lib/python2.7/dist-packages/onvif_zeep-0.2.12-py2.7.egg/onvif/client.py", line 26, in wrapped
    raise ONVIFError(err)
onvif.exceptions.ONVIFError: Unknown error: super() takes at least 1 argument (0 given)

the packages I installed are:

sudo pip install onvif
sudo pip install --upgrade onvif_zeep

and which I curious is : only install onvif, not install onvif_zeep , the code can run correctly, after install onvif_zeep, the problem occurs. Why ?

PS: when install onvif_zeep, I clone this repository, and run cd python-onvif-zeep & sudo python setup.py install, it failed.
Then I try sudo pip install --upgrade onvif_zeep and it succeed. Why ?

Any help will be appreciated, thanks.

Issue with create_type() from ONVIFCamera().create_ptz_service()

Hello

My Python version is 3.5.3. I followed the guide for installation.

The issue is :

mycam=ONVIFCamera("192.168.5.6",888,"admin","*******","/home/guilmort/ONVIF/python-onvif-zeep/wsdl/")
ptz=mycam.create_ptz_service()
media = mycam.create_media_service()
media_profile = media.GetProfiles()[0]
token=media_profile.token
request=ptz.create_type('ContinuousMove')
request.ProfileToken=token
request.Velocity.Zoom.x=-1.0   ---------------> AttributeError: 'NoneType' object has no attribute 'Zoom'

However when I do

request.Velocity={'Zoom':{'x':-1.0}}

Then it works.

Bad Request for authenticated calls

Hi,

I am investigating an issue of ONVIF camera support in HA (see home-assistant/core#20668). It looks like calls that require authentication are not working.

For example, when I make a call to media_service.GetProfiles(), I get this error:

Couldn't setup camera 'cam1'. Error: Unknown error: (400, 'Bad Request')

Note that non-authenticated requests work fine:

[custom_components.camera.onvif] Setting up the ONVIF camera component
[custom_components.camera.onvif] Setting up the ONVIF camera device @ '192.168.1.xxx:80'
[custom_components.camera.onvif] Setting up the ONVIF device management service
[custom_components.camera.onvif] Retrieving current camera date/time
[custom_components.camera.onvif] Camera date/time: 2019-02-01 20:08:42
[custom_components.camera.onvif] System date/time: 2019-02-01 20:08:43.444658
[custom_components.camera.onvif] Retrieving capabilities
[custom_components.camera.onvif] Found 7 capabilities
[custom_components.camera.onvif] * Analytics
[custom_components.camera.onvif] * Device
[custom_components.camera.onvif] * Events
[custom_components.camera.onvif] * Imaging
[custom_components.camera.onvif] * Media
[custom_components.camera.onvif] * PTZ
[custom_components.camera.onvif] * Extension
[custom_components.camera.onvif] Setting up the ONVIF media service
[custom_components.camera.onvif] Setting up the ONVIF PTZ service
[custom_components.camera.onvif] Completed set up of the ONVIF camera component

Whenever I try to use the same username/password using a SOAP tool (for example, SoapUI), I am able to make the calls whenever I set authentication to Digest with the right username / password.

Maybe it's possible to get something from the headers (of a successful call):

POST http://192.168.1.xxx/onvif/ HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: application/soap+xml;charset=UTF-8
Content-Length: 216
Host: 192.168.1.xxx
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
Authorization: Digest username="admin", realm="Login to xxxx", nonce="xxxx", uri="/onvif/", response="xxxx", qop=auth, nc=00000001, cnonce="xxxx", opaque=""

Any ideas what could be the issue?

Single Command or Interactive Command not clear

Hi everybody,
the script works very well and i'm able to change the host name to the camera ( as per instruction)
but it's not clear on how to form the request for the ContinuousMove or other complex commands.

for example, in the Interactive Mode:
$ onvif-cli -u 'admin' -a '1234' --host '192.168.0.1' --port 80 --wsdl /etc/onvif/wsdl/
ONVIF>> cmd ptz ContinuousMove { 'ProfileToken' : 'profilePrimary' , 'Velocity' (...then it's not clear how to form the tree for the current request...)

Please somebody help me because are now 2 weeks that i'm playing with it without any solution

contrib to the code

i've submitted the PR "add ability to use a camera under nat" let me know if is ok in this way , or you prefer something different!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.