quatanium / python-onvif

ONVIF Client Implementation in Python
MIT License
471 stars 319 forks source link

The examples doesn't work. #4

Closed flyingpang closed 9 years ago

flyingpang commented 9 years ago

@sinchb I test examples in examples folder and test.py in the tests folder today,but these didn't work.I open my local addr 192.168.0.112 in brower. I run in ubuntu(desktop14.4.2).PS: I am new hand in ONVIF.so I am sorry for this stupid issues. Traceback (most recent call last): File "continuous_move.py", line 83, in continuous_move() File "continuous_move.py", line 43, in continuous_move mycam = ONVIFCamera('192.168.0.112', 80, 'admin', '12345') File "/usr/local/lib/python2.7/dist-packages/onvif-0.1.2-py2.7.egg/onvif/client.py", line 216, in init self.update_xaddrs() File "/usr/local/lib/python2.7/dist-packages/onvif-0.1.2-py2.7.egg/onvif/client.py", line 226, in update_xaddrs services = self.devicemgmt.GetServices({'IncludeCapability': False}) File "/usr/local/lib/python2.7/dist-packages/onvif-0.1.2-py2.7.egg/onvif/client.py", line 28, in wrapped raise ONVIFError(err) onvif.exceptions.ONVIFError: Unknown error:urlopen error time out

flyingpang commented 9 years ago

@sinchb @taiyangc I run it in virturalbox, can the discover protocol nomal work ?

sinchb commented 9 years ago

continuous_move.py is just an EXAMPLE. It works well ONLY with MY CAMERA. you should use onvif-cli or ONVFIService of this lib to test your camera. Before your testing, you should know the IP, Port, username, password of your camera.

sinchb commented 9 years ago

@flyingpang Anything else?

flyingpang commented 9 years ago

@sinchb I install dual system in my computer,I use nmap scan the inter addr,find the cam ip is 192.168.0.116,port is 81,I modify them in continuous_move.py,but it still doesn't work,Maybe my ipcam dosen't support the ONVIF? Traceback (most recent call last): File "continuous_move.py", line 83, in continuous_move() File "continuous_move.py", line 43, in continuous_move mycam = ONVIFCamera('192.168.0.116', 81, 'admin', '888888') File "/usr/local/lib/python2.7/dist-packages/onvif-0.1.2-py2.7.egg/onvif/client.py", line 216, in init self.update_xaddrs() File "/usr/local/lib/python2.7/dist-packages/onvif-0.1.2-py2.7.egg/onvif/client.py", line 222, in update_xaddrs self.devicemgmt = self.create_devicemgmt_service() File "/usr/local/lib/python2.7/dist-packages/onvif-0.1.2-py2.7.egg/onvif/client.py", line 331, in create_devicemgmt_service return self.create_onvif_service('devicemgmt', from_template) File "/usr/local/lib/python2.7/dist-packages/onvif-0.1.2-py2.7.egg/onvif/client.py", line 319, in create_onvif_service self.daemon) File "/usr/local/lib/python2.7/dist-packages/onvif-0.1.2-py2.7.egg/onvif/client.py", line 28, in wrapped raise ONVIFError(err) onvif.exceptions.ONVIFError: Unknown error: <urlopen error [Errno -2] Name or service not known>

sinchb commented 9 years ago

Please read my comment writen 4 days ago. You can NOT use continuous_move.py to test your camera.

flyingpang commented 9 years ago

@sinchb Sorry,I misunderstand your meaning,at first thought if I just modify ip,port in continuous_move(),The cam will work.Thx

sinchb commented 9 years ago

Ok, I will close this issue

Morketh commented 7 years ago

continuous_move.py is just an EXAMPLE. It works well ONLY with MY CAMERA. you should use onvif-cli or ONVFIService of this lib to test your camera.

Might i suggest adding those file names to a .gitignore so that we (the public) do not get your private test scripts or as a much better alternative set up a generic framework that can be setup for a broader spectrum of ONVIF compatible devices.

Traceback (most recent call last):
  File "./probe.py", line 89, in <module>
    mycam = ONVIFCamera('192.168.0.22', 80, 'admin', 'admin', '/etc/onvif/wsdl/')
  File "/usr/local/lib/python2.7/dist-packages/onvif/client.py", line 227, in __init__
    self.update_xaddrs()
  File "/usr/local/lib/python2.7/dist-packages/onvif/client.py", line 237, in update_xaddrs
    services = self.devicemgmt.GetServices({'IncludeCapability': False})
  File "/usr/local/lib/python2.7/dist-packages/onvif/client.py", line 31, in wrapped
    raise ONVIFError(err)
onvif.exceptions.ONVIFError: Unknown error: <urlopen error timed out>

as it stands im not sure if this is a problem with my python programming or if this is a problem with the library. My OS is Kali (Debian based 4.9.0-kali4-amd64 #1 SMP Debian 4.9.30-1kali1 (2017-06-06) x86_64 GNU/Linux) after running the install using pip install onvif I fired up the python console and imported the library. however once running the Example on the README.md provided with the project it failed telling me that several WSDL documents were in fact missing. I found them all in the repository under wsdl and copied them to etc. now it seems to load up an instance fine however i still cannot interface with the camera. I have over 150 cameras that i would like to manage all were purchased at the same time from the same manufacture (Zhejiang Dahua Technology Co., Ltd.) I'm running Zoneminder for CCTV recording and picks up ONVIF compatible devices i would rather not have to walk through every camera with the zoneminder install wizard. Providing i can communicate with the camera using this library i should be able to obtain all of the needed information and build the Zoneminder database with Python. Once the MySQL database has been built with the camera information i also have to change Static IP Address assignments from the Camera Web-Interface as well as System Clock settings and administrative logon. Asking to do this manually on that number of devices is a big task i would like to solve this using a python application to automate the mind numbing task.