Skip to content

media_service.GetProfiles() -> onvif.exceptions.ONVIFError: Unknown error: Unknown fault occured #123

@MaxKKuznetsov

Description

@MaxKKuznetsov

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions