FalkTannhaeuser / python-onvif-zeep

ONVIF Client Implementation in Python 2+3 (using https://github.com/mvantellingen/python-zeep instead of suds as SOAP client)
MIT License
424 stars 138 forks source link

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

Closed uched41 closed 5 years ago

uched41 commented 5 years ago

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,