从 IP 摄像机使用 Python 获取 Onvif 事件

问题描述

我有一个发送运动事件的 IP 摄像机。 使用 Onvif 设备管理器,我还可以看到这些事件。 但是,我无法使用 Python 脚本获取这些事件。 起点是 Github 项目:https://github.com/FalkTannhaeuser/python-onvif-zeep

如果我从 documentation 中正确读取了它,首先您必须执行一个名为“CreatePullPointSubscriptionRequest”的函数。 作为响应,您会收到“CreatePullPointSubscriptionResponse”。 然后你可以执行函数'PullMessagesRequest'。

有人可以向我发送代码片段以注册事件(全部或过滤)然后读取事件吗?

这是我目前所拥有的:

from onvif import ONVIFCamera
mycam = ONVIFCamera('192.168.0.2',80,'user','passwd','/etc/onvif/wsdl/')

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

event_service = mycam.create_events_service()
print(event_service.GetEventProperties())

subscription = event_service.CreatePullPointSubscription()

pullpoint = mycam.create_pullpoint_service()
req = pullpoint.create_type('PullMessages') # Exception: No element 'PullMessages' in namespace http://docs.oasis-open.org/wsrf/rw-2. Available elements are:  - 
req.MessageLimit=100
print(pullpoint.PullMessages(req))

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...