Open MaxKKuznetsov opened 7 months ago
You are calling it the wrong way. This should work:
media_service = mycam.create_media_service() resp = mycam.media.GetProfiles() print('Profile data: ' + str(resp))
Hopefully this helped :)
@MaxKKuznetsov have you fix this error? Have the same problem. Proposed solution unfortunately does not work.
I have the same issue with Hikvision PTZ Kamera (DS-2DE2A404IW-DE3)
I digged a little in the soap requests. The issue might be because of a 401 (Unauthorized) response of some requests e.g. GetProfiles()
:
<html>
<head>
<title>Document Error: Unauthorized</title>
</head>
<body>
<h2>Access Error: 401 --
Unauthorized</h2>
<p>Authentication Error: This onvif request requires authentication
information</p>
</body>
</html>```
@MaxKKuznetsov & @gitwojtek
I resolved the unathorized issue with the suggested solution in this post: https://ipcamtalk.com/threads/onvif-problem-with-hikvision-dvr-the-http-request-is-unauthorized-with-client-authentication-scheme.42433/post-747891
Just set authentication to "digest+ws-username" or "digest+wsse" token (In camera settings - configuration / network / advanced settings / integration protocol) and make sure your time is accurate.
So this is a Hardware/Firmware setup issue not an issue with python-onvif-zeep. Please confirm, then the issue can be closed.
Hi, I was trying to connect a ptz camera with API on python. But I faced a weird problem. The API can see the camera and return the hostname. But when I try to return the media profile (GetProfiles()) there is an error appears: .. zeep.exceptions.Fault: Unknown fault occured .. onvif.exceptions.ONVIFError: Unknown error: Unknown fault occured
Furthermore, the same code works well on different camera ('good' camera: DH-SD59232XA-HNR, Firmware: V2.810.0000017.1.R.P9.3217.UN.NR). I'll be glad if anyone can help.
Camera: DS-2DE7A432IW-AEB Firmware Version: V5.8.0 build 230519 WEB: V5.1.0_R0101 build 230213 ONVIF : 19.12
python 3.6 zeep==4.1.0 onvif-zeep==0.2.12
Code:
from onvif import ONVIFCamera
ptz_username = 'xxx' ptz_password = 'yyy' ptz_ip = '-.-.-.-' ptz_port = 80
wsdl_folder = '/usr/local/lib/python3.6/site-packages/wsdl'
mycam = ONVIFCamera(ptz_ip, ptz_port, ptz_username, ptz_password, wsdl_folder)
resp = mycam.devicemgmt.GetHostname() print(f'My camera`s hostname: {str(resp.Name)}')
media_service = mycam.create_media_service()
media_profile = media_service.GetProfiles()[0]
The error message: My camera`s hostname: Hikvision <onvif.client.ONVIFService object at 0x7f832d7320> Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/onvif/client.py", line 23, in wrapped return func(*args, kwargs) File "/usr/local/lib/python3.6/dist-packages/onvif/client.py", line 153, in wrapped return call(params, callback) File "/usr/local/lib/python3.6/dist-packages/onvif/client.py", line 140, in call ret = func(params) File "/usr/local/lib/python3.6/dist-packages/zeep/proxy.py", line 51, in call kwargs, File "/usr/local/lib/python3.6/dist-packages/zeep/wsdl/bindings/soap.py", line 135, in send return self.process_reply(client, operation_obj, response) File "/usr/local/lib/python3.6/dist-packages/zeep/wsdl/bindings/soap.py", line 229, in process_reply return self.process_error(doc, operation) File "/usr/local/lib/python3.6/dist-packages/zeep/wsdl/bindings/soap.py", line 356, in process_error detail=etree_to_string(doc), zeep.exceptions.Fault: Unknown fault occured
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "ptz_test.py", line 23, in
media_profile = media_service.GetProfiles()[0]
File "/usr/local/lib/python3.6/dist-packages/onvif/client.py", line 26, in wrapped
raise ONVIFError(err)
onvif.exceptions.ONVIFError: Unknown error: Unknown fault occured