fbradyirl / hikvision Goto Github PK
View Code? Open in Web Editor NEWA Python module for interacting with Hikvision IP Cameras
License: MIT License
A Python module for interacting with Hikvision IP Cameras
License: MIT License
The example script imports hikvision.py
- the file in the repo is named api.py
.
I changed the example thus:
`import api
hik_camera = api.CreateDevice(...` and so on.
The script api.py
imports hikvision.error
- the error file is named error.py
, and likewise hikvision.constants
is named constants.py
. I changed api.py
thus:
from error import...
and so on,
from constants import...
and so on (once for each of the two references).
Of course, renaming the files is probably the more sensible way!
Hello, I want to develop the function of snapshot for hikvision in python, but I can not find CGI API Guide from the URL resource you give from the README. Is there a backup or something?
I have this camera by Hikvision (https://www.hikvision.com/en/products/IP-Products/PTZ-Cameras/Pro-Series/DS-2DE7225IW-AE/?q=ds-2de7225iw-ae&position=2).
By now I'm able to get video stream with rtsp protocol and VideoCapture from opencv.
Is it possible with the API from this repository to control the Pan Tilt Zoom of the camera?
How to generate qr for other devices?
Hello @fbradyirl
I have been trying to grasp some good code for hikvision NVR's (which have only IP Cameras) to do "video download". Is there any way your code can do this?
Thank for your replies.
Hey Just looking for the API documentation that the README links to is no longer a valid link.
Would you be able to link to the API Documentation that your using or even include it in the repo.
Appreciate the help.
The project looks great. Cant wait to start using it.
I filed a bug in the Home Assistant repo. However, looks like the problem is related to the underlying library. I am unable to disable motion using the library. See the trace below:
>>> hik_camera.is_motion_detection_enabled()
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.2.91
DEBUG:urllib3.connectionpool:http://192.168.2.91:80 "GET /MotionDetection/1 HTTP/1.1" 200 406
DEBUG:hikvision.api:Response: <?xml version="1.0" encoding="UTF-8"?>
<MotionDetection version="1.0" xmlns="http://www.hikvision.com/ver10/XMLSchema">
<id>1</id>
<enabled>true</enabled>
<regionType>grid</regionType>
<Grid>
<rowGranularity>15</rowGranularity>
<columnGranularity>22</columnGranularity>
</Grid>
<MotionDetectionRegionList>
<sensitivityLevel>1</sensitivityLevel>
</MotionDetectionRegionList>
</MotionDetection>
INFO:hikvision.api:Current motion detection state? enabled: true
True
>>> hik_camera.disable_motion_detection()
DEBUG:hikvision.api:xml:
DEBUG:hikvision.api:b'<MotionDetection xmlns="http://www.hikvision.com/ver10/XMLSchema" version="1.0">\n<id>1</id>\n<enabled>false</enabled>\n<regionType>grid</regionType>\n<Grid>\n<rowGranularity>15</rowGranularity>\n<columnGranularity>22</columnGranularity>\n</Grid>\n<MotionDetectionRegionList>\n<sensitivityLevel>1</sensitivityLevel>\n</MotionDetectionRegionList>\n</MotionDetection>'
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.6/site-packages/requests/utils.py", line 868, in check_header_validity
if not pat.match(value):
TypeError: expected string or bytes-like object
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/srv/homeassistant/lib/python3.6/site-packages/hikvision/api.py", line 235, in disable_motion_detection
self.put_motion_detection_xml(self.xml_motion_detection_off)
File "/srv/homeassistant/lib/python3.6/site-packages/hikvision/api.py", line 247, in put_motion_detection_xml
self._username, self._password), data=xml, headers=headers)
File "/srv/homeassistant/lib/python3.6/site-packages/requests/api.py", line 126, in put
return request('put', url, data=data, **kwargs)
File "/srv/homeassistant/lib/python3.6/site-packages/requests/api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "/srv/homeassistant/lib/python3.6/site-packages/requests/sessions.py", line 494, in request
prep = self.prepare_request(req)
File "/srv/homeassistant/lib/python3.6/site-packages/requests/sessions.py", line 437, in prepare_request
hooks=merge_hooks(request.hooks, self.hooks),
File "/srv/homeassistant/lib/python3.6/site-packages/requests/models.py", line 306, in prepare
self.prepare_headers(headers)
File "/srv/homeassistant/lib/python3.6/site-packages/requests/models.py", line 440, in prepare_headers
check_header_validity(header)
File "/srv/homeassistant/lib/python3.6/site-packages/requests/utils.py", line 872, in check_header_validity
"bytes, not %s" % (name, value, type(value)))
requests.exceptions.InvalidHeader: Value for header {Content-Length: 354} must be of type str or bytes, not <class 'int'>
>>>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.