This commit is contained in:
darthsandmann
2023-02-11 19:37:07 +01:00
parent 15ed948dcd
commit d1289421b9
84 changed files with 34044 additions and 2 deletions

View File

@ -0,0 +1 @@
pip

View File

@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2014 Quatanium Co., Ltd.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,189 @@
Metadata-Version: 2.1
Name: onvif-zeep-async
Version: 1.2.0
Summary: Async Python Client for ONVIF Camera
Home-page: http://github.com/hunterjm/python-onvif-zeep-async
Author: Cherish Chen
Author-email: sinchb128@gmail.com
Maintainer: sinchb
Maintainer-email: sinchb128@gmail.com
License: MIT
Keywords: ONVIF,Camera,IPC
Platform: UNKNOWN
Requires-Python: >=3
Requires-Dist: httpx (<1.0.0,>=0.19.0)
Requires-Dist: zeep[async] (<5.0.0,>=4.1.0)
python-onvif-zeep-async
=======================
ONVIF Client Implementation in Python 3
Dependencies
------------
`zeep[async] <http://docs.python-zeep.org>`_ >= 4.1.0, < 5.0.0
`httpx <https://www.python-httpx.org/>`_ >= 0.19.0, < 1.0.0
Install python-onvif-zeep-async
-------------------------------
**From Source**
You should clone this repository and run setup.py::
cd python-onvif-zeep-async && python setup.py install
Alternatively, you can run::
pip install --upgrade onvif-zeep-async
Getting Started
---------------
Initialize an ONVIFCamera instance
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
::
from onvif import ONVIFCamera
mycam = ONVIFCamera('192.168.0.2', 80, 'user', 'passwd', '/etc/onvif/wsdl/')
await mycam.update_xaddrs()
Now, an ONVIFCamera instance is available. By default, a devicemgmt service is also available if everything is OK.
So, all operations defined in the WSDL document::
/etc/onvif/wsdl/devicemgmt.wsdl
are available.
Get information from your camera
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
::
# Get Hostname
resp = await mycam.devicemgmt.GetHostname()
print 'My camera`s hostname: ' + str(resp.Name)
# Get system date and time
dt = await mycam.devicemgmt.GetSystemDateAndTime()
tz = dt.TimeZone
year = dt.UTCDateTime.Date.Year
hour = dt.UTCDateTime.Time.Hour
Configure (Control) your camera
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To configure your camera, there are two ways to pass parameters to service methods.
**Dict**
This is the simpler way::
params = {'Name': 'NewHostName'}
await device_service.SetHostname(params)
**Type Instance**
This is the recommended way. Type instance will raise an
exception if you set an invalid (or non-existent) parameter.
::
params = mycam.devicemgmt.create_type('SetHostname')
params.Hostname = 'NewHostName'
await mycam.devicemgmt.SetHostname(params)
time_params = mycam.devicemgmt.create_type('SetSystemDateAndTime')
time_params.DateTimeType = 'Manual'
time_params.DaylightSavings = True
time_params.TimeZone.TZ = 'CST-8:00:00'
time_params.UTCDateTime.Date.Year = 2014
time_params.UTCDateTime.Date.Month = 12
time_params.UTCDateTime.Date.Day = 3
time_params.UTCDateTime.Time.Hour = 9
time_params.UTCDateTime.Time.Minute = 36
time_params.UTCDateTime.Time.Second = 11
await mycam.devicemgmt.SetSystemDateAndTime(time_params)
Use other services
~~~~~~~~~~~~~~~~~~
ONVIF protocol has defined many services.
You can find all the services and operations `here <http://www.onvif.org/onvif/ver20/util/operationIndex.html>`_.
ONVIFCamera has support methods to create new services::
# Create ptz service
ptz_service = mycam.create_ptz_service()
# Get ptz configuration
await mycam.ptz.GetConfiguration()
# Another way
# await ptz_service.GetConfiguration()
Or create an unofficial service::
xaddr = 'http://192.168.0.3:8888/onvif/yourservice'
yourservice = mycam.create_onvif_service('service.wsdl', xaddr, 'yourservice')
await yourservice.SomeOperation()
# Another way
# await mycam.yourservice.SomeOperation()
ONVIF CLI
---------
python-onvif also provides a command line interactive interface: onvif-cli.
onvif-cli is installed automatically.
Single command example
~~~~~~~~~~~~~~~~~~~~~~
::
$ onvif-cli devicemgmt GetHostname --user 'admin' --password '12345' --host '192.168.0.112' --port 80
True: {'FromDHCP': True, 'Name': hision}
$ onvif-cli devicemgmt SetHostname "{'Name': 'NewerHostname'}" --user 'admin' --password '12345' --host '192.168.0.112' --port 80
True: {}
Interactive mode
~~~~~~~~~~~~~~~~
::
$ onvif-cli -u 'admin' -a '12345' --host '192.168.0.112' --port 80 --wsdl /etc/onvif/wsdl/
ONVIF >>> cmd
analytics devicemgmt events imaging media ptz
ONVIF >>> cmd devicemgmt GetWsdlUrl
True: http://www.onvif.org/
ONVIF >>> cmd devicemgmt SetHostname {'Name': 'NewHostname'}
ONVIF >>> cmd devicemgmt GetHostname
True: {'Name': 'NewHostName'}
ONVIF >>> cmd devicemgmt SomeOperation
False: No Operation: SomeOperation
NOTE: Tab completion is supported for interactive mode.
Batch mode
~~~~~~~~~~
::
$ vim batchcmds
$ cat batchcmds
cmd devicemgmt GetWsdlUrl
cmd devicemgmt SetHostname {'Name': 'NewHostname', 'FromDHCP': True}
cmd devicemgmt GetHostname
$ onvif-cli --host 192.168.0.112 -u admin -a 12345 -w /etc/onvif/wsdl/ < batchcmds
ONVIF >>> True: http://www.onvif.org/
ONVIF >>> True: {}
ONVIF >>> True: {'FromDHCP': False, 'Name': NewHostname}
References
----------
* `ONVIF Offical Website <http://www.onvif.com>`_
* `Operations Index <http://www.onvif.org/onvif/ver20/util/operationIndex.html>`_
* `ONVIF Develop Documents <http://www.onvif.org/specs/DocMap-2.4.2.html>`_
* `Foscam Python Lib <http://github.com/quatanium/foscam-python-lib>`_

View File

@ -0,0 +1,53 @@
../../../bin/onvif-cli,sha256=MAGXs94BBofHuAiVBTfKfcqsA_XM7ST0DEk9gA6XQWM,214
onvif/__init__.py,sha256=DAsdFf5oJMqju-l7Vb-abV5z4RQ1fpZ8ddJmwD3zVok,599
onvif/__pycache__/__init__.cpython-310.pyc,,
onvif/__pycache__/client.cpython-310.pyc,,
onvif/__pycache__/definition.cpython-310.pyc,,
onvif/__pycache__/exceptions.cpython-310.pyc,,
onvif/client.py,sha256=-o7t3DF9lg45rQqGZa8VysfO_KFmvt1LMPoD51geL7E,16455
onvif/definition.py,sha256=dT2uCtYYxIWHVghIHnITos4WOzjOIPotPsaEWGdx9lg,2190
onvif/exceptions.py,sha256=mbyY-nIc7yfApB_q3YcYm0471wY0KNFoJ7bYP9Szgp8,886
onvif/version.txt,sha256=HltRzeUVOWqfp2KQnPjKZYTMxWSzJdLuvup2F1_pXE0,6
onvif/wsdl/__init__.py,sha256=Em3m8NWsx8UMimkXjJIny_LgRuGGgQ5_J_BokzWDuQY,26
onvif/wsdl/__pycache__/__init__.cpython-310.pyc,,
onvif/wsdl/accesscontrol.wsdl,sha256=GKQRCg8cSF4IRm2NdppfA0QX-CdxKpSiqr5L0AYFpbM,38072
onvif/wsdl/actionengine.wsdl,sha256=jMPBM2GD3s2fh7n8LipF_bPNZhvzb1DLYNUZV6h19tA,57255
onvif/wsdl/addressing,sha256=mqQSab7i4cPEbSmTDE_ce6-9nB4xVJmNRVRExqAqMEE,7263
onvif/wsdl/advancedsecurity.wsdl,sha256=yTL8gF152Qm-RXeizLhULhpFfDOKkIUx74N3OJIMQBI,79284
onvif/wsdl/analytics.wsdl,sha256=W5laHpMfME71MQwNjhS1LBtbZ4TIHFewyX22KXzrNu4,24131
onvif/wsdl/analyticsdevice.wsdl,sha256=QCLXOfnRgbEIiTILaTbMUCbTBn42Z9ufhByrsZ5jJCQ,31976
onvif/wsdl/b-2.xsd,sha256=oftw2i1rYft_ok8JknHx34npjJxvpChojE01j0ObbP8,23300
onvif/wsdl/bf-2.xsd,sha256=9ala3IYLci5voOa04yJjR0hxMs1OI6T7gMmR8kQaIjs,5100
onvif/wsdl/bw-2.wsdl,sha256=5M7OMEKxmlcbKRzWrD2rERRSdeJ38RiDEskpBqXEDBY,20498
onvif/wsdl/deviceio.wsdl,sha256=dG4by3ReWpY6sWWPPLQfkvcZjaj4SSN0BCC1bfzIrwo,60231
onvif/wsdl/devicemgmt.wsdl,sha256=Eg7OATq94VcY-hgb4l4qzxpSdm3Kr0Bd2sVfOZ4MeCI,163209
onvif/wsdl/display.wsdl,sha256=ypm5RYq0X2Ac5oCy3OfXcEiQ1lvcOP_EAfygwROEPTY,24593
onvif/wsdl/doorcontrol.wsdl,sha256=FKjpZNFd8jDmacXhacyt7mvdwZeIWSoSJADVKg0QQSM,53648
onvif/wsdl/envelope,sha256=nGb4i3mtYNbVtjg5u7cJsM39WRiYw1rBh8PCcsR7Uq4,6249
onvif/wsdl/events.wsdl,sha256=9GLKEWYPwoxHj5YqQGjb2Ui4hg6v0xb4sm6YZ2x-hhg,37870
onvif/wsdl/imaging.wsdl,sha256=_s0QauUK5wtAc_B26DUY6o9py2ZzmmHb9SGDA6LIW9E,17998
onvif/wsdl/include,sha256=3_kQDvzkr7Id4M9nP7f60QNnKhaYYqsPEuNMMSsg5g0,511
onvif/wsdl/media.wsdl,sha256=pu1qNRCWgbunJ2DYZw80Xgsic25Frj0EVQX8vZ9YLr0,174812
onvif/wsdl/onvif.xsd,sha256=nRdmSnFoTEOrM444eoGSg1YDZH45NCgCHCA0YYk3NLc,363349
onvif/wsdl/ptz.wsdl,sha256=yY_iflOkYaqivi9Ene4iQyzgrR6VUtPuiiNnm5lXYBM,54058
onvif/wsdl/r-2.xsd,sha256=5vnupoUZkNcSRgsgzZPJiCZqj-E-wnM3zFCdUy1yFhY,3660
onvif/wsdl/receiver.wsdl,sha256=Fqamd4htp9phs_S_jdFIcW2T-VyILwSrUdJX1jox_YE,17214
onvif/wsdl/recording.wsdl,sha256=taj5YpiTJwPboUgAGuUw29HVxa0TBKDEL3zReHjfy7g,40704
onvif/wsdl/remotediscovery.wsdl,sha256=UoU7dgABpVHDCSxLFnsa2DXyNzIteGVXie6rhAyaxNY,5596
onvif/wsdl/replay.wsdl,sha256=Yvs6a9b00tyFLTgptT67wvPyUqmlKp4OpqabA-UL3O8,10581
onvif/wsdl/rw-2.wsdl,sha256=zv4pjJUS5IBz523QQolHzaN42Hh9aF7yAqFBXszBGnM,3727
onvif/wsdl/search.wsdl,sha256=llUg6aAOOIRJFebwV7Th3KTVFBwEOG3FdGiAX2Dj_JY,43139
onvif/wsdl/t-1.xsd,sha256=rV2wQyo4hdHIpXS6a0BYGTrym8lxIyxLtrMfgpX-Myk,8960
onvif/wsdl/types.xsd,sha256=k1k3M6krspu9qKz0Wc45ix-foPeg_mI8t3XucagdfoI,3738
onvif/wsdl/ws-addr.xsd,sha256=r4Bsya8lFOmwsH7-Tk3EKjLa2KwIRz3AJRNiB3edXuk,5849
onvif/wsdl/ws-discovery.xsd,sha256=nJgWWM0EgHm82w2zxM5-WhHnulpvyB7vh-R5VFdXquE,10455
onvif/wsdl/xml.xsd,sha256=YZYPsxMeOAIsqtU2Di8zozgleKs8gM1YvXQyDt5hsgw,8836
onvif/wsdl/xmlmime,sha256=Mwq3ns3TqGKPEu9MvjQ1HkSPm5IxusrTOYgc4aYSN6I,1639
onvif_zeep_async-1.2.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
onvif_zeep_async-1.2.0.dist-info/LICENSE,sha256=ZEQ7HH321Omn-RdwKJZsIzEFs26TN-xJxzy3VxPTWIk,1087
onvif_zeep_async-1.2.0.dist-info/METADATA,sha256=XfKRbZNsDsoh2XPPauylogMn7MzvPeZsjzuTLEHoDXE,5371
onvif_zeep_async-1.2.0.dist-info/RECORD,,
onvif_zeep_async-1.2.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
onvif_zeep_async-1.2.0.dist-info/WHEEL,sha256=kGT74LWyRUZrL4VgLh6_g12IeVl_9u9ZVhadrgXZUEY,110
onvif_zeep_async-1.2.0.dist-info/entry_points.txt,sha256=T86-G39qBuLrqpISnl9sHjvR2Lt_KeMSAQus_tvBYM0,46
onvif_zeep_async-1.2.0.dist-info/top_level.txt,sha256=MqCi1uJmIvtVFJDz2IxLbpwq6FwDtWhqrWQtKwLaQg4,6

View File

@ -0,0 +1,6 @@
Wheel-Version: 1.0
Generator: bdist_wheel (0.34.2)
Root-Is-Purelib: true
Tag: py2-none-any
Tag: py3-none-any

View File

@ -0,0 +1,3 @@
[console_scripts]
onvif-cli = onvif.cli:main

View File

@ -0,0 +1 @@
onvif