onvif-python 0.0.9__tar.gz → 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. {onvif_python-0.0.9/onvif_python.egg-info → onvif_python-0.1.1}/PKG-INFO +120 -56
  2. {onvif_python-0.0.9 → onvif_python-0.1.1}/README.md +119 -55
  3. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/__init__.py +11 -0
  4. onvif_python-0.1.1/onvif/cli/__init__.py +5 -0
  5. onvif_python-0.1.1/onvif/cli/__main__.py +11 -0
  6. onvif_python-0.1.1/onvif/cli/interactive.py +1140 -0
  7. onvif_python-0.1.1/onvif/cli/main.py +216 -0
  8. onvif_python-0.1.1/onvif/cli/utils.py +476 -0
  9. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/client.py +63 -45
  10. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/utils/exceptions.py +27 -5
  11. onvif_python-0.1.1/onvif/utils/wsdl.py +576 -0
  12. {onvif_python-0.0.9 → onvif_python-0.1.1/onvif_python.egg-info}/PKG-INFO +120 -56
  13. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif_python.egg-info/SOURCES.txt +7 -0
  14. onvif_python-0.1.1/onvif_python.egg-info/entry_points.txt +2 -0
  15. {onvif_python-0.0.9 → onvif_python-0.1.1}/pyproject.toml +4 -1
  16. onvif_python-0.1.1/tests/test_client.py +278 -0
  17. onvif_python-0.1.1/tests/test_core.py +378 -0
  18. onvif_python-0.1.1/tests/test_error_handlers.py +344 -0
  19. onvif_python-0.1.1/tests/test_exceptions.py +339 -0
  20. onvif_python-0.1.1/tests/test_wsdl_map.py +47 -0
  21. onvif_python-0.0.9/onvif/utils/wsdl.py +0 -297
  22. onvif_python-0.0.9/tests/test_client.py +0 -0
  23. onvif_python-0.0.9/tests/test_core.py +0 -0
  24. onvif_python-0.0.9/tests/test_exceptions.py +0 -0
  25. onvif_python-0.0.9/tests/test_wsdl_map.py +0 -27
  26. {onvif_python-0.0.9 → onvif_python-0.1.1}/LICENSE.md +0 -0
  27. {onvif_python-0.0.9 → onvif_python-0.1.1}/MANIFEST.in +0 -0
  28. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/operator.py +0 -0
  29. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/services/__init__.py +0 -0
  30. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/services/accesscontrol.py +0 -0
  31. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/services/accessrules.py +0 -0
  32. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/services/actionengine.py +0 -0
  33. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/services/analytics/analytics.py +0 -0
  34. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/services/analytics/ruleengine.py +0 -0
  35. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/services/analyticsdevice.py +0 -0
  36. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/services/appmgmt.py +0 -0
  37. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/services/authenticationbehavior.py +0 -0
  38. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/services/credential.py +0 -0
  39. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/services/deviceio.py +0 -0
  40. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/services/devicemgmt.py +0 -0
  41. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/services/display.py +0 -0
  42. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/services/doorcontrol.py +0 -0
  43. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/services/events/events.py +0 -0
  44. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/services/events/notification.py +0 -0
  45. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/services/events/pullpoint.py +0 -0
  46. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/services/events/subscription.py +0 -0
  47. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/services/imaging.py +0 -0
  48. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/services/media.py +0 -0
  49. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/services/media2.py +0 -0
  50. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/services/provisioning.py +0 -0
  51. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/services/ptz.py +0 -0
  52. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/services/receiver.py +0 -0
  53. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/services/recording.py +0 -0
  54. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/services/replay.py +0 -0
  55. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/services/schedule.py +0 -0
  56. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/services/search.py +0 -0
  57. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/services/security/advancedsecurity.py +0 -0
  58. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/services/security/authorizationserver.py +0 -0
  59. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/services/security/dot1x.py +0 -0
  60. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/services/security/jwt.py +0 -0
  61. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/services/security/keystore.py +0 -0
  62. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/services/security/mediasigning.py +0 -0
  63. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/services/security/tlsserver.py +0 -0
  64. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/services/thermal.py +0 -0
  65. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/services/uplink.py +0 -0
  66. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/utils/__init__.py +0 -0
  67. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/utils/error_handlers.py +0 -0
  68. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/utils/xml_capture.py +0 -0
  69. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/utils/zeep.py +0 -0
  70. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/accesscontrol/wsdl/index.html +0 -0
  71. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/accessrules/wsdl/accessrules.wsdl +0 -0
  72. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/accessrules/wsdl/index.html +0 -0
  73. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/actionengine.wsdl +0 -0
  74. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/advancedsecurity/wsdl/advancedsecurity.wsdl +0 -0
  75. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/advancedsecurity/wsdl/index.html +0 -0
  76. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/analyticsdevice.wsdl +0 -0
  77. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/appmgmt/wsdl/appmgmt.wsdl +0 -0
  78. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/appmgmt/wsdl/index.html +0 -0
  79. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/authenticationbehavior/wsdl/authenticationbehavior.wsdl +0 -0
  80. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/authenticationbehavior/wsdl/index.html +0 -0
  81. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/credential/wsdl/credential.wsdl +0 -0
  82. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/credential/wsdl/index.html +0 -0
  83. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/device/wsdl/devicemgmt.wsdl +0 -0
  84. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/deviceio.wsdl +0 -0
  85. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/display/display.wsdl +0 -0
  86. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/display/wsdl/index.htm +0 -0
  87. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/display.wsdl +0 -0
  88. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/doorcontrol/wsdl/index.html +0 -0
  89. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/events/wsdl/bw-2-vs-mod.wsdl +0 -0
  90. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/events/wsdl/event-vs.wsdl +0 -0
  91. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/events/wsdl/event.wsdl +0 -0
  92. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/events/wsdl/index.html +0 -0
  93. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/federatedsearch.wsdl +0 -0
  94. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/media/wsdl/media.wsdl +0 -0
  95. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/pacs/accesscontrol.wsdl +0 -0
  96. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/pacs/doorcontrol.wsdl +0 -0
  97. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/pacs/types.xsd +0 -0
  98. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/provisioning/wsdl/provisioning.wsdl +0 -0
  99. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/receiver.wsdl +0 -0
  100. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/recording.wsdl +0 -0
  101. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/replay.wsdl +0 -0
  102. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/schedule/wsdl/index.html +0 -0
  103. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/schedule/wsdl/schedule.wsdl +0 -0
  104. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/schema/common.xsd +0 -0
  105. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/schema/metadatastream.xsd +0 -0
  106. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/schema/onvif.xsd +0 -0
  107. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/search.wsdl +0 -0
  108. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/thermal/wsdl/index.html +0 -0
  109. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/thermal/wsdl/thermal.wsdl +0 -0
  110. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/topics/topicns.xml +0 -0
  111. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/uplink/wsdl/index.html +0 -0
  112. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver10/uplink/wsdl/uplink.wsdl +0 -0
  113. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver20/analytics/humanbody.xsd +0 -0
  114. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver20/analytics/humanface.xsd +0 -0
  115. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver20/analytics/index.html +0 -0
  116. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver20/analytics/radiometry.xsd +0 -0
  117. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver20/analytics/rules.xsd +0 -0
  118. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver20/analytics/wsdl/analytics.wsdl +0 -0
  119. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver20/analytics/wsdl/index.html +0 -0
  120. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver20/imaging/wsdl/imaging.wsdl +0 -0
  121. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver20/media/wsdl/index.html +0 -0
  122. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver20/media/wsdl/media.wsdl +0 -0
  123. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver20/ptz/wsdl/ptz.wsdl +0 -0
  124. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver20/util/federated_search_documentation.html +0 -0
  125. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver20/util/fedsearch-docu-viewer.xsl +0 -0
  126. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver20/util/onvif-wsdl-viewer.xsl +0 -0
  127. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif/wsdl/ver20/util/operationIndex.html +0 -0
  128. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif_python.egg-info/dependency_links.txt +0 -0
  129. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif_python.egg-info/requires.txt +0 -0
  130. {onvif_python-0.0.9 → onvif_python-0.1.1}/onvif_python.egg-info/top_level.txt +0 -0
  131. {onvif_python-0.0.9 → onvif_python-0.1.1}/setup.cfg +0 -0
  132. {onvif_python-0.0.9 → onvif_python-0.1.1}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: onvif-python
3
- Version: 0.0.9
3
+ Version: 0.1.1
4
4
  Summary: A comprehensive and developer-friendly Python library for working with ONVIF-compliant devices
5
5
  Author-email: Nirsimetri Technologies® <open@nirsimetri.com>
6
6
  Maintainer: Kaburagi
@@ -40,9 +40,9 @@ Dynamic: license-file
40
40
 
41
41
  [![License](https://img.shields.io/badge/License-MIT-blue)](https://github.com/nirsimetri/onvif-python?tab=MIT-1-ov-file)
42
42
  [![DeepWiki](https://img.shields.io/badge/DeepWiki-AI%20Wiki-orange)](https://deepwiki.com/nirsimetri/onvif-python)
43
- [![Release](https://img.shields.io/badge/Release-v0.0.9-red?logo=archive)](https://github.com/nirsimetri/onvif-python/releases)
43
+ [![Release](https://img.shields.io/badge/Release-v0.1.1-red?logo=archive)](https://github.com/nirsimetri/onvif-python/releases)
44
44
  <br>
45
- [![PyPI](https://img.shields.io/badge/PyPI-0.0.9-yellow?logo=archive)](https://pypi.org/project/onvif-python/)
45
+ [![PyPI](https://img.shields.io/badge/PyPI-0.1.1-yellow?logo=archive)](https://pypi.org/project/onvif-python/)
46
46
  [![Downloads](https://img.shields.io/pypi/dm/onvif-python?label=PyPI%20Downloads)](https://clickpy.clickhouse.com/dashboard/onvif-python)
47
47
 
48
48
  **This project provides a comprehensive and developer-friendly Python library for working with ONVIF-compliant devices.** It is designed to be reliable, easy to integrate, and flexible enough to support a wide range of ONVIF profiles and services.
@@ -66,6 +66,13 @@ This library simplifies that process by wrapping SOAP communication into a clean
66
66
  - **Companies** building video intelligence, analytics, or VMS platforms
67
67
  - **Security integrators** who need reliable ONVIF interoperability across devices
68
68
 
69
+ ## Requirements
70
+
71
+ - **Python**: 3.9 or higher
72
+ - **Dependencies**:
73
+ - [`zeep>=4.3.0`](https://github.com/mvantellingen/python-zeep) - SOAP client for ONVIF communication
74
+ - [`requests>=2.32.0`](https://github.com/psf/requests) - HTTP library for network requests
75
+
69
76
  ## Installation
70
77
 
71
78
  From official [PyPI](https://pypi.org/project/onvif-python/):
@@ -93,7 +100,14 @@ Create an instance of `ONVIFClient` by providing your device's IP address, port,
93
100
  ```python
94
101
  from onvif import ONVIFClient
95
102
 
103
+ # Basic connection
96
104
  client = ONVIFClient("192.168.1.17", 8000, "admin", "admin123")
105
+
106
+ # With custom WSDL directory (optional)
107
+ client = ONVIFClient(
108
+ "192.168.1.17", 8000, "admin", "admin123",
109
+ wsdl_dir="/path/to/custom/wsdl" # Use custom WSDL files in this path
110
+ )
97
111
  ```
98
112
 
99
113
  **2. Create Service Instance**
@@ -144,6 +158,73 @@ Explore more advanced usage and service-specific operations in the [`examples/`]
144
158
  > [!IMPORTANT]
145
159
  > If you're new to ONVIF and want to learn more, we highly recommend taking the official free online course provided by ONVIF at [Introduction to ONVIF Course](https://www.onvif.org/about/introduction-to-onvif-course). Please note that we are not endorsed or sponsored by ONVIF, see [Legal Notice](#legal-notice) for details.
146
160
 
161
+ ## ONVIF CLI
162
+
163
+ > [!NOTE]
164
+ > The CLI is automatically installed when you install the `onvif-python` see [Installation](#installation). This feature has been available since onvif-python version [0.1.0](https://github.com/nirsimetri/onvif-python/releases/tag/v0.1.1)
165
+
166
+ This library includes a powerful command-line interface (CLI) for interacting with ONVIF devices directly from your terminal. It supports both direct command execution and an interactive shell mode, providing a flexible and efficient way to manage and debug ONVIF devices.
167
+
168
+ ### Features
169
+
170
+ - **Interactive Shell:** A user-friendly shell with tab completion, command history, and colorized output.
171
+ - **Direct Command Execution:** Run ONVIF commands directly from the terminal for scripting and automation.
172
+ - **Automatic Discovery:** Automatically detects available services on the device.
173
+ - **Connection Management:** Supports HTTP/HTTPS, custom timeouts, and SSL verification.
174
+ - **Data Management:** Store results from commands and use them as parameters in subsequent commands.
175
+ - **Cross-Platform:** Works on Windows, macOS, and Linux.
176
+
177
+ ### Usage
178
+
179
+ **1. Interactive Mode**
180
+
181
+ The interactive shell is recommended for exploration and debugging. It provides an intuitive way to navigate services, call methods, and view results.
182
+
183
+ To start the interactive shell, provide the connection details:
184
+
185
+ ```bash
186
+ onvif --host 192.168.1.17 --port 8000 --username admin --password admin123 -i
187
+ ```
188
+
189
+ If you omit the username or password, you will be prompted to enter them securely.
190
+
191
+ **Interactive Shell Commands:**
192
+ | Command | Description |
193
+ |---|---|
194
+ | `help` | Show help information |
195
+ | `ls` | List available services or methods in the current context |
196
+ | `cd <service>` | Enter a service mode (e.g., `cd devicemgmt`) |
197
+ | `up` | Go back to the root context |
198
+ | `pwd` | Show the current service context |
199
+ | `desc <method>` | Show documentation for a method |
200
+ | `store <name>` | Store the last result with a variable name |
201
+ | `show <name>` | Display a stored variable |
202
+ | `exit` / `quit` | Exit the shell |
203
+
204
+ You can see all the commands available in the interactive shell by trying them directly.
205
+
206
+ **2. Direct Command Execution**
207
+
208
+ You can also execute a single ONVIF command directly. This is useful for scripting or quick checks.
209
+
210
+ **Syntax:**
211
+ ```bash
212
+ onvif <service> <method> [parameters...] -H <host> -P <port> -u <user> -p <pass>
213
+ ```
214
+
215
+ **Example:**
216
+ ```bash
217
+ # Get device capabilities
218
+ onvif devicemgmt GetCapabilities Category=All -H 192.168.1.17 -P 8000 -u admin -p admin123
219
+
220
+ # Move a PTZ camera
221
+ onvif ptz ContinuousMove ProfileToken=Profile_1 Velocity='{"PanTilt": {"x": 0.1}}' -H 192.168.1.17 -P 8000 -u admin -p admin123
222
+ ```
223
+
224
+ ### CLI Parameters
225
+
226
+ All `ONVIFClient` parameters (like `--timeout`, `--https`, `--cache`, etc.) are available as command-line arguments. Use `onvif --help` to see all available options.
227
+
147
228
  ## ONVIFClient Parameters
148
229
 
149
230
  The `ONVIFClient` class provides various configuration options to customize the connection behavior, caching strategy, security settings, and debugging capabilities. Below is a detailed description of all available parameters:
@@ -186,8 +267,9 @@ The `ONVIFClient` class provides various configuration options to customize the
186
267
 
187
268
  | Parameter | Type | Required | Default | Description |
188
269
  |-----------|------|----------|---------|-------------|
189
- | `apply_patch` | `bool` | ❌ No | `True` | Enable zeep patching for better `xsd:any` field parsing and automatic flattening |
190
- | `capture_xml` | `bool` | ❌ No | `False` | Enable XML capture plugin for debugging SOAP requests/responses |
270
+ | `apply_patch` | `bool` | ❌ No | `True` | Enable zeep patching for better `xsd:any` field parsing and automatic flattening, applied at ([`>=v0.0.4`](https://github.com/nirsimetri/onvif-python/releases/tag/v0.0.4)) |
271
+ | `capture_xml` | `bool` | ❌ No | `False` | Enable XML capture plugin for debugging SOAP requests/responses, applied at ([`>=v0.0.6`](https://github.com/nirsimetri/onvif-python/releases/tag/v0.0.6)) |
272
+ | `wsdl_dir` | `str` | ❌ No | `None` | Custom WSDL directory path for using external WSDL files instead of built-in ones (e.g., `/path/to/custom/wsdl`), applied at ([`>=v0.1.0`](https://github.com/nirsimetri/onvif-python/releases/tag/v0.1.0)) |
191
273
 
192
274
  </details>
193
275
 
@@ -317,6 +399,33 @@ if client.xml_plugin:
317
399
  > - `save_to_file(request_file, response_file)` - Save XML to files
318
400
  > - `clear_history()` - Clear captured history
319
401
 
402
+ **Custom WSDL Directory:**
403
+ ```python
404
+ from onvif import ONVIFClient
405
+
406
+ # Use custom WSDL files instead of built-in ones
407
+ client = ONVIFClient(
408
+ "192.168.1.17",
409
+ 80,
410
+ "admin",
411
+ "password",
412
+ wsdl_dir="/path/to/custom/wsdl" # Custom WSDL directory
413
+ )
414
+
415
+ # All services will automatically use custom WSDL files
416
+ device = client.devicemgmt()
417
+ media = client.media()
418
+ ptz = client.ptz()
419
+
420
+ # The custom WSDL directory should have a flat structure:
421
+ # /path/to/custom/wsdl/
422
+ # ├── devicemgmt.wsdl
423
+ # ├── media.wsdl
424
+ # ├── ptz.wsdl
425
+ # ├── imaging.wsdl
426
+ # └── ... (other WSDL files)
427
+ ```
428
+
320
429
  </details>
321
430
 
322
431
  <details>
@@ -336,7 +445,8 @@ client = ONVIFClient(
336
445
  use_https=True, # Secure communication
337
446
  verify_ssl=True, # Verify certificates (default)
338
447
  apply_patch=True, # Enhanced parsing (default)
339
- capture_xml=False # Disable debug mode (default)
448
+ capture_xml=False, # Disable debug mode (default)
449
+ wsdl_dir=None # Use built-in WSDL files (default)
340
450
  )
341
451
  ```
342
452
  </details>
@@ -346,6 +456,7 @@ client = ONVIFClient(
346
456
  - **Authentication:** This library uses **WS-UsernameToken with Digest** authentication by default, which is the standard for ONVIF devices.
347
457
  - **Patching:** The `apply_patch=True` (default) enables custom zeep patching that improves `xsd:any` field parsing. This is recommended for better compatibility with ONVIF responses.
348
458
  - **XML Capture:** Only use `capture_xml=True` during development/debugging as it increases memory usage and may expose sensitive data in logs.
459
+ - **Custom WSDL:** Use `wsdl_dir` parameter to specify a custom directory containing WSDL files. The directory should have a flat structure with WSDL files directly in the root (e.g., `/path/to/custom/wsdl/devicemgmt.wsdl`, `/path/to/custom/wsdl/media.wsdl`, etc.).
349
460
  - **Cache Location:** Disk cache (when using `CacheMode.DB` or `CacheMode.ALL`) is stored in `~/.onvif-python/onvif_zeep_cache.sqlite`.
350
461
 
351
462
  ## Service Discovery: Understanding Device Capabilities
@@ -391,53 +502,6 @@ else:
391
502
  - **GetCapabilities** is **mandatory** for all ONVIF-compliant devices, ensuring broader compatibility
392
503
  - **Default URLs** guarantee basic connectivity even with non-compliant devices
393
504
 
394
- **Get detailed service information:**
395
-
396
- If you need comprehensive service details, you can manually call `GetServices` with capabilities:
397
-
398
- ```python
399
- device = client.devicemgmt()
400
-
401
- try:
402
- # Try to get detailed service information
403
- services = device.GetServices(IncludeCapability=True)
404
- for service in services:
405
- print(f"Service: {service.Namespace}")
406
- print(f"XAddr: {service.XAddr}")
407
- if hasattr(service, 'Capabilities'):
408
- print(f"Capabilities: {service.Capabilities}")
409
- except Exception:
410
- # Fallback to GetCapabilities for legacy devices
411
- capabilities = device.GetCapabilities()
412
- print("Capabilities:", capabilities)
413
- ```
414
-
415
- **Access capabilities information:**
416
-
417
- When using `GetCapabilities` fallback, you can access capability information:
418
-
419
- ```python
420
- device = client.devicemgmt()
421
-
422
- try:
423
- # Get capabilities information from device
424
- capabilities = device.GetCapabilities()
425
-
426
- # Main services (always available)
427
- print("Media XAddr:", getattr(capabilities.Media, 'XAddr', 'Not available'))
428
- print("PTZ XAddr:", getattr(capabilities.PTZ, 'XAddr', 'Not available'))
429
-
430
- # Extension services (device-dependent)
431
- ext = getattr(capabilities, 'Extension', None)
432
- if ext:
433
- print("DeviceIO XAddr:", getattr(ext.DeviceIO, 'XAddr', 'Not available'))
434
- print("Recording XAddr:", getattr(ext.Recording, 'XAddr', 'Not available'))
435
- print("Search XAddr:", getattr(ext.Search, 'XAddr', 'Not available'))
436
- print("Replay XAddr:", getattr(ext.Replay, 'XAddr', 'Not available'))
437
- except Exception as e:
438
- print(f"Error getting capabilities: {e}")
439
- ```
440
-
441
505
  > [!TIP]
442
506
  > The library handles service discovery automatically with intelligent fallback. You typically don't need to call discovery methods manually unless you need detailed capability information or want to refresh the service list after device configuration changes.
443
507
 
@@ -592,10 +656,10 @@ Some ONVIF services have multiple bindings in the same WSDL. These typically inc
592
656
 
593
657
  ## Future Improvements (Stay tuned and star ⭐ this repo)
594
658
 
595
- - [x] Add debugging mode with raw xml on SOAP requests and responses. ([c258162](https://github.com/nirsimetri/onvif-python/commit/c258162))
596
- - [ ] Add functionality for `ONVIFClient` to accept a custom `wsdl_path` service.
659
+ - [x] ~~Add debugging mode with raw xml on SOAP requests and responses.~~ ([c258162](https://github.com/nirsimetri/onvif-python/commit/c258162))
660
+ - [x] ~~Add functionality for `ONVIFClient` to accept a custom `wsdl_dir` service.~~ ([65f2570](https://github.com/nirsimetri/onvif-python/commit/65f2570))
661
+ - [x] ~~Add `ONVIF CLI` program to interact directly with ONVIF devices via terminal.~~ ([645be01](https://github.com/nirsimetri/onvif-python/commit/645be01))
597
662
  - [ ] Add asynchronous (async/await) support for non-blocking ONVIF operations and concurrent device communication.
598
- - [ ] Add `ONVIF CLI` program to interact directly with ONVIF devices via terminal.
599
663
  - [ ] Implement structured data models for ONVIF Schemas using [xsdata](https://github.com/tefra/xsdata).
600
664
  - [ ] Integrate [xmltodict](https://github.com/martinblech/xmltodict) for simplified XML parsing and conversion.
601
665
  - [ ] Enhance documentation with API references and diagrams (not from [AI Wiki](https://deepwiki.com/nirsimetri/onvif-python)).
@@ -2,9 +2,9 @@
2
2
 
3
3
  [![License](https://img.shields.io/badge/License-MIT-blue)](https://github.com/nirsimetri/onvif-python?tab=MIT-1-ov-file)
4
4
  [![DeepWiki](https://img.shields.io/badge/DeepWiki-AI%20Wiki-orange)](https://deepwiki.com/nirsimetri/onvif-python)
5
- [![Release](https://img.shields.io/badge/Release-v0.0.9-red?logo=archive)](https://github.com/nirsimetri/onvif-python/releases)
5
+ [![Release](https://img.shields.io/badge/Release-v0.1.1-red?logo=archive)](https://github.com/nirsimetri/onvif-python/releases)
6
6
  <br>
7
- [![PyPI](https://img.shields.io/badge/PyPI-0.0.9-yellow?logo=archive)](https://pypi.org/project/onvif-python/)
7
+ [![PyPI](https://img.shields.io/badge/PyPI-0.1.1-yellow?logo=archive)](https://pypi.org/project/onvif-python/)
8
8
  [![Downloads](https://img.shields.io/pypi/dm/onvif-python?label=PyPI%20Downloads)](https://clickpy.clickhouse.com/dashboard/onvif-python)
9
9
 
10
10
  **This project provides a comprehensive and developer-friendly Python library for working with ONVIF-compliant devices.** It is designed to be reliable, easy to integrate, and flexible enough to support a wide range of ONVIF profiles and services.
@@ -28,6 +28,13 @@ This library simplifies that process by wrapping SOAP communication into a clean
28
28
  - **Companies** building video intelligence, analytics, or VMS platforms
29
29
  - **Security integrators** who need reliable ONVIF interoperability across devices
30
30
 
31
+ ## Requirements
32
+
33
+ - **Python**: 3.9 or higher
34
+ - **Dependencies**:
35
+ - [`zeep>=4.3.0`](https://github.com/mvantellingen/python-zeep) - SOAP client for ONVIF communication
36
+ - [`requests>=2.32.0`](https://github.com/psf/requests) - HTTP library for network requests
37
+
31
38
  ## Installation
32
39
 
33
40
  From official [PyPI](https://pypi.org/project/onvif-python/):
@@ -55,7 +62,14 @@ Create an instance of `ONVIFClient` by providing your device's IP address, port,
55
62
  ```python
56
63
  from onvif import ONVIFClient
57
64
 
65
+ # Basic connection
58
66
  client = ONVIFClient("192.168.1.17", 8000, "admin", "admin123")
67
+
68
+ # With custom WSDL directory (optional)
69
+ client = ONVIFClient(
70
+ "192.168.1.17", 8000, "admin", "admin123",
71
+ wsdl_dir="/path/to/custom/wsdl" # Use custom WSDL files in this path
72
+ )
59
73
  ```
60
74
 
61
75
  **2. Create Service Instance**
@@ -106,6 +120,73 @@ Explore more advanced usage and service-specific operations in the [`examples/`]
106
120
  > [!IMPORTANT]
107
121
  > If you're new to ONVIF and want to learn more, we highly recommend taking the official free online course provided by ONVIF at [Introduction to ONVIF Course](https://www.onvif.org/about/introduction-to-onvif-course). Please note that we are not endorsed or sponsored by ONVIF, see [Legal Notice](#legal-notice) for details.
108
122
 
123
+ ## ONVIF CLI
124
+
125
+ > [!NOTE]
126
+ > The CLI is automatically installed when you install the `onvif-python` see [Installation](#installation). This feature has been available since onvif-python version [0.1.0](https://github.com/nirsimetri/onvif-python/releases/tag/v0.1.1)
127
+
128
+ This library includes a powerful command-line interface (CLI) for interacting with ONVIF devices directly from your terminal. It supports both direct command execution and an interactive shell mode, providing a flexible and efficient way to manage and debug ONVIF devices.
129
+
130
+ ### Features
131
+
132
+ - **Interactive Shell:** A user-friendly shell with tab completion, command history, and colorized output.
133
+ - **Direct Command Execution:** Run ONVIF commands directly from the terminal for scripting and automation.
134
+ - **Automatic Discovery:** Automatically detects available services on the device.
135
+ - **Connection Management:** Supports HTTP/HTTPS, custom timeouts, and SSL verification.
136
+ - **Data Management:** Store results from commands and use them as parameters in subsequent commands.
137
+ - **Cross-Platform:** Works on Windows, macOS, and Linux.
138
+
139
+ ### Usage
140
+
141
+ **1. Interactive Mode**
142
+
143
+ The interactive shell is recommended for exploration and debugging. It provides an intuitive way to navigate services, call methods, and view results.
144
+
145
+ To start the interactive shell, provide the connection details:
146
+
147
+ ```bash
148
+ onvif --host 192.168.1.17 --port 8000 --username admin --password admin123 -i
149
+ ```
150
+
151
+ If you omit the username or password, you will be prompted to enter them securely.
152
+
153
+ **Interactive Shell Commands:**
154
+ | Command | Description |
155
+ |---|---|
156
+ | `help` | Show help information |
157
+ | `ls` | List available services or methods in the current context |
158
+ | `cd <service>` | Enter a service mode (e.g., `cd devicemgmt`) |
159
+ | `up` | Go back to the root context |
160
+ | `pwd` | Show the current service context |
161
+ | `desc <method>` | Show documentation for a method |
162
+ | `store <name>` | Store the last result with a variable name |
163
+ | `show <name>` | Display a stored variable |
164
+ | `exit` / `quit` | Exit the shell |
165
+
166
+ You can see all the commands available in the interactive shell by trying them directly.
167
+
168
+ **2. Direct Command Execution**
169
+
170
+ You can also execute a single ONVIF command directly. This is useful for scripting or quick checks.
171
+
172
+ **Syntax:**
173
+ ```bash
174
+ onvif <service> <method> [parameters...] -H <host> -P <port> -u <user> -p <pass>
175
+ ```
176
+
177
+ **Example:**
178
+ ```bash
179
+ # Get device capabilities
180
+ onvif devicemgmt GetCapabilities Category=All -H 192.168.1.17 -P 8000 -u admin -p admin123
181
+
182
+ # Move a PTZ camera
183
+ onvif ptz ContinuousMove ProfileToken=Profile_1 Velocity='{"PanTilt": {"x": 0.1}}' -H 192.168.1.17 -P 8000 -u admin -p admin123
184
+ ```
185
+
186
+ ### CLI Parameters
187
+
188
+ All `ONVIFClient` parameters (like `--timeout`, `--https`, `--cache`, etc.) are available as command-line arguments. Use `onvif --help` to see all available options.
189
+
109
190
  ## ONVIFClient Parameters
110
191
 
111
192
  The `ONVIFClient` class provides various configuration options to customize the connection behavior, caching strategy, security settings, and debugging capabilities. Below is a detailed description of all available parameters:
@@ -148,8 +229,9 @@ The `ONVIFClient` class provides various configuration options to customize the
148
229
 
149
230
  | Parameter | Type | Required | Default | Description |
150
231
  |-----------|------|----------|---------|-------------|
151
- | `apply_patch` | `bool` | ❌ No | `True` | Enable zeep patching for better `xsd:any` field parsing and automatic flattening |
152
- | `capture_xml` | `bool` | ❌ No | `False` | Enable XML capture plugin for debugging SOAP requests/responses |
232
+ | `apply_patch` | `bool` | ❌ No | `True` | Enable zeep patching for better `xsd:any` field parsing and automatic flattening, applied at ([`>=v0.0.4`](https://github.com/nirsimetri/onvif-python/releases/tag/v0.0.4)) |
233
+ | `capture_xml` | `bool` | ❌ No | `False` | Enable XML capture plugin for debugging SOAP requests/responses, applied at ([`>=v0.0.6`](https://github.com/nirsimetri/onvif-python/releases/tag/v0.0.6)) |
234
+ | `wsdl_dir` | `str` | ❌ No | `None` | Custom WSDL directory path for using external WSDL files instead of built-in ones (e.g., `/path/to/custom/wsdl`), applied at ([`>=v0.1.0`](https://github.com/nirsimetri/onvif-python/releases/tag/v0.1.0)) |
153
235
 
154
236
  </details>
155
237
 
@@ -279,6 +361,33 @@ if client.xml_plugin:
279
361
  > - `save_to_file(request_file, response_file)` - Save XML to files
280
362
  > - `clear_history()` - Clear captured history
281
363
 
364
+ **Custom WSDL Directory:**
365
+ ```python
366
+ from onvif import ONVIFClient
367
+
368
+ # Use custom WSDL files instead of built-in ones
369
+ client = ONVIFClient(
370
+ "192.168.1.17",
371
+ 80,
372
+ "admin",
373
+ "password",
374
+ wsdl_dir="/path/to/custom/wsdl" # Custom WSDL directory
375
+ )
376
+
377
+ # All services will automatically use custom WSDL files
378
+ device = client.devicemgmt()
379
+ media = client.media()
380
+ ptz = client.ptz()
381
+
382
+ # The custom WSDL directory should have a flat structure:
383
+ # /path/to/custom/wsdl/
384
+ # ├── devicemgmt.wsdl
385
+ # ├── media.wsdl
386
+ # ├── ptz.wsdl
387
+ # ├── imaging.wsdl
388
+ # └── ... (other WSDL files)
389
+ ```
390
+
282
391
  </details>
283
392
 
284
393
  <details>
@@ -298,7 +407,8 @@ client = ONVIFClient(
298
407
  use_https=True, # Secure communication
299
408
  verify_ssl=True, # Verify certificates (default)
300
409
  apply_patch=True, # Enhanced parsing (default)
301
- capture_xml=False # Disable debug mode (default)
410
+ capture_xml=False, # Disable debug mode (default)
411
+ wsdl_dir=None # Use built-in WSDL files (default)
302
412
  )
303
413
  ```
304
414
  </details>
@@ -308,6 +418,7 @@ client = ONVIFClient(
308
418
  - **Authentication:** This library uses **WS-UsernameToken with Digest** authentication by default, which is the standard for ONVIF devices.
309
419
  - **Patching:** The `apply_patch=True` (default) enables custom zeep patching that improves `xsd:any` field parsing. This is recommended for better compatibility with ONVIF responses.
310
420
  - **XML Capture:** Only use `capture_xml=True` during development/debugging as it increases memory usage and may expose sensitive data in logs.
421
+ - **Custom WSDL:** Use `wsdl_dir` parameter to specify a custom directory containing WSDL files. The directory should have a flat structure with WSDL files directly in the root (e.g., `/path/to/custom/wsdl/devicemgmt.wsdl`, `/path/to/custom/wsdl/media.wsdl`, etc.).
311
422
  - **Cache Location:** Disk cache (when using `CacheMode.DB` or `CacheMode.ALL`) is stored in `~/.onvif-python/onvif_zeep_cache.sqlite`.
312
423
 
313
424
  ## Service Discovery: Understanding Device Capabilities
@@ -353,53 +464,6 @@ else:
353
464
  - **GetCapabilities** is **mandatory** for all ONVIF-compliant devices, ensuring broader compatibility
354
465
  - **Default URLs** guarantee basic connectivity even with non-compliant devices
355
466
 
356
- **Get detailed service information:**
357
-
358
- If you need comprehensive service details, you can manually call `GetServices` with capabilities:
359
-
360
- ```python
361
- device = client.devicemgmt()
362
-
363
- try:
364
- # Try to get detailed service information
365
- services = device.GetServices(IncludeCapability=True)
366
- for service in services:
367
- print(f"Service: {service.Namespace}")
368
- print(f"XAddr: {service.XAddr}")
369
- if hasattr(service, 'Capabilities'):
370
- print(f"Capabilities: {service.Capabilities}")
371
- except Exception:
372
- # Fallback to GetCapabilities for legacy devices
373
- capabilities = device.GetCapabilities()
374
- print("Capabilities:", capabilities)
375
- ```
376
-
377
- **Access capabilities information:**
378
-
379
- When using `GetCapabilities` fallback, you can access capability information:
380
-
381
- ```python
382
- device = client.devicemgmt()
383
-
384
- try:
385
- # Get capabilities information from device
386
- capabilities = device.GetCapabilities()
387
-
388
- # Main services (always available)
389
- print("Media XAddr:", getattr(capabilities.Media, 'XAddr', 'Not available'))
390
- print("PTZ XAddr:", getattr(capabilities.PTZ, 'XAddr', 'Not available'))
391
-
392
- # Extension services (device-dependent)
393
- ext = getattr(capabilities, 'Extension', None)
394
- if ext:
395
- print("DeviceIO XAddr:", getattr(ext.DeviceIO, 'XAddr', 'Not available'))
396
- print("Recording XAddr:", getattr(ext.Recording, 'XAddr', 'Not available'))
397
- print("Search XAddr:", getattr(ext.Search, 'XAddr', 'Not available'))
398
- print("Replay XAddr:", getattr(ext.Replay, 'XAddr', 'Not available'))
399
- except Exception as e:
400
- print(f"Error getting capabilities: {e}")
401
- ```
402
-
403
467
  > [!TIP]
404
468
  > The library handles service discovery automatically with intelligent fallback. You typically don't need to call discovery methods manually unless you need detailed capability information or want to refresh the service list after device configuration changes.
405
469
 
@@ -554,10 +618,10 @@ Some ONVIF services have multiple bindings in the same WSDL. These typically inc
554
618
 
555
619
  ## Future Improvements (Stay tuned and star ⭐ this repo)
556
620
 
557
- - [x] Add debugging mode with raw xml on SOAP requests and responses. ([c258162](https://github.com/nirsimetri/onvif-python/commit/c258162))
558
- - [ ] Add functionality for `ONVIFClient` to accept a custom `wsdl_path` service.
621
+ - [x] ~~Add debugging mode with raw xml on SOAP requests and responses.~~ ([c258162](https://github.com/nirsimetri/onvif-python/commit/c258162))
622
+ - [x] ~~Add functionality for `ONVIFClient` to accept a custom `wsdl_dir` service.~~ ([65f2570](https://github.com/nirsimetri/onvif-python/commit/65f2570))
623
+ - [x] ~~Add `ONVIF CLI` program to interact directly with ONVIF devices via terminal.~~ ([645be01](https://github.com/nirsimetri/onvif-python/commit/645be01))
559
624
  - [ ] Add asynchronous (async/await) support for non-blocking ONVIF operations and concurrent device communication.
560
- - [ ] Add `ONVIF CLI` program to interact directly with ONVIF devices via terminal.
561
625
  - [ ] Implement structured data models for ONVIF Schemas using [xsdata](https://github.com/tefra/xsdata).
562
626
  - [ ] Integrate [xmltodict](https://github.com/martinblech/xmltodict) for simplified XML parsing and conversion.
563
627
  - [ ] Enhance documentation with API references and diagrams (not from [AI Wiki](https://deepwiki.com/nirsimetri/onvif-python)).
@@ -4,6 +4,14 @@ from .client import ONVIFClient
4
4
  from .operator import ONVIFOperator, CacheMode
5
5
  from .utils import ONVIFWSDL, ONVIFOperationException, ONVIFErrorHandler, ZeepPatcher
6
6
 
7
+ # CLI module is optional - import only if needed
8
+ try:
9
+ from .cli import main as ONVIFCLI
10
+
11
+ CLI_AVAILABLE = True
12
+ except ImportError:
13
+ CLI_AVAILABLE = False
14
+
7
15
  __all__ = [
8
16
  "ONVIFClient",
9
17
  "ONVIFOperator",
@@ -13,3 +21,6 @@ __all__ = [
13
21
  "ONVIFErrorHandler",
14
22
  "ZeepPatcher",
15
23
  ]
24
+
25
+ if CLI_AVAILABLE:
26
+ __all__.append("ONVIFCLI")
@@ -0,0 +1,5 @@
1
+ # onvif/cli/__init__.py
2
+
3
+ from .main import main
4
+
5
+ __all__ = ["main"]
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env python3
2
+ # onvif/cli/__main__.py
3
+
4
+ """
5
+ ONVIF CLI entry point for python -m onvif.cli
6
+ """
7
+
8
+ from .main import main
9
+
10
+ if __name__ == "__main__":
11
+ main()