隐形摄影机的客户端
hikvisionapi的Python项目详细描述
[![Circleci](https://circleci.com/gh/missial/hikvision-client.svg?(https://circleci.com/gh/missial/hikvision/hikvision-client)
(安装
``bash ``bash
pip install hikvisionapi
``
;示例
有两种接收格式一个响应:
```python
respons=cam.system.deviceinfo.system.deviceinfo(方法‘get’)
``````` python
`` python
}
}
\xml文本响应
response=cam.system.deviceinfo(method='get',present='text')
response='''<;?xml version=“1.0”encoding=“utf-8”?>;
<;设备信息version=“1.0”xmlns=“http://www.hikvision.com/ver20/xmlschema”>;
<;设备名称>;hikvision<;/设备名称>;
<;/设备信息>;''
```
提示:
``python
data=xml)
type='stream')
response==[{
u'eventnotificationalert':{
u'@version':u'2.0',
u'@xmlns':u'http://www.hikvision.com/ver20/xmlschema',
u'activepostcount':u'0',
u'channelid':u'1',
u'datetime':u'2018-03-21t15:49:02+08:00',
u'eventdescription':u'videoloss alarm',
u'eventstate':u'inactive',
u'eventtype':u'videoloss'
}
}
超时=1)
为真时:
尝试:
响应=cam.event.notification.alertstream(method='get',type='stream')
如果响应:
则打印响应
例外情况除外:
传递
以获取不透明数据类型并写入文件
响应=cam.system.configurationdata(method='get',键入'opaque廑data')
,open('my廑file','wb')作为f:
作为响应的块。iter廑u content(chunk廑size=1024):
如果块:
f.write(chunk)
从相机获取并保存图片
响应=客户端。流媒体。频道[102].picture(method='get',type='opaque_data')
打开('screen.jpg',“wb”)作为f:
用于响应的块。iter_内容(块大小=1024):
如果块:
f.write(块)
````
./htmlcov/
```
(安装
``bash ``bash
pip install hikvisionapi
``
;示例
有两种接收格式一个响应:
```python
``````` python
`` python
}
\xml文本响应
response=cam.system.deviceinfo(method='get',present='text')
response='''<;?xml version=“1.0”encoding=“utf-8”?>;
<;设备信息version=“1.0”xmlns=“http://www.hikvision.com/ver20/xmlschema”>;
<;设备名称>;hikvision<;/设备名称>;
<;/设备信息>;''
```
提示:
``python
data=xml)
type='stream')
response==[{
u'eventnotificationalert':{
u'@version':u'2.0',
u'@xmlns':u'http://www.hikvision.com/ver20/xmlschema',
u'activepostcount':u'0',
u'channelid':u'1',
u'datetime':u'2018-03-21t15:49:02+08:00',
u'eventdescription':u'videoloss alarm',
u'eventstate':u'inactive',
u'eventtype':u'videoloss'
}
}
超时=1)
为真时:
尝试:
响应=cam.event.notification.alertstream(method='get',type='stream')
如果响应:
则打印响应
例外情况除外:
传递
以获取不透明数据类型并写入文件
响应=cam.system.configurationdata(method='get',键入'opaque廑data')
,open('my廑file','wb')作为f:
作为响应的块。iter廑u content(chunk廑size=1024):
如果块:
f.write(chunk)
从相机获取并保存图片
响应=客户端。流媒体。频道[102].picture(method='get',type='opaque_data')
打开('screen.jpg',“wb”)作为f:
用于响应的块。iter_内容(块大小=1024):
如果块:
f.write(块)
````
./htmlcov/
```