onvif-python 0.1.0__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.
- {onvif_python-0.1.0/onvif_python.egg-info → onvif_python-0.1.1}/PKG-INFO +82 -55
- {onvif_python-0.1.0 → onvif_python-0.1.1}/README.md +81 -54
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/__init__.py +11 -0
- onvif_python-0.1.1/onvif/cli/__init__.py +5 -0
- onvif_python-0.1.1/onvif/cli/__main__.py +11 -0
- onvif_python-0.1.1/onvif/cli/interactive.py +1140 -0
- onvif_python-0.1.1/onvif/cli/main.py +216 -0
- onvif_python-0.1.1/onvif/cli/utils.py +476 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/client.py +18 -18
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/utils/exceptions.py +27 -5
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/utils/wsdl.py +267 -41
- {onvif_python-0.1.0 → onvif_python-0.1.1/onvif_python.egg-info}/PKG-INFO +82 -55
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif_python.egg-info/SOURCES.txt +7 -0
- onvif_python-0.1.1/onvif_python.egg-info/entry_points.txt +2 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/pyproject.toml +4 -1
- onvif_python-0.1.1/tests/test_client.py +278 -0
- onvif_python-0.1.1/tests/test_core.py +378 -0
- onvif_python-0.1.1/tests/test_error_handlers.py +344 -0
- onvif_python-0.1.1/tests/test_exceptions.py +339 -0
- onvif_python-0.1.1/tests/test_wsdl_map.py +47 -0
- onvif_python-0.1.0/tests/test_client.py +0 -0
- onvif_python-0.1.0/tests/test_core.py +0 -0
- onvif_python-0.1.0/tests/test_exceptions.py +0 -0
- onvif_python-0.1.0/tests/test_wsdl_map.py +0 -27
- {onvif_python-0.1.0 → onvif_python-0.1.1}/LICENSE.md +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/MANIFEST.in +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/operator.py +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/services/__init__.py +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/services/accesscontrol.py +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/services/accessrules.py +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/services/actionengine.py +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/services/analytics/analytics.py +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/services/analytics/ruleengine.py +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/services/analyticsdevice.py +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/services/appmgmt.py +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/services/authenticationbehavior.py +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/services/credential.py +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/services/deviceio.py +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/services/devicemgmt.py +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/services/display.py +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/services/doorcontrol.py +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/services/events/events.py +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/services/events/notification.py +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/services/events/pullpoint.py +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/services/events/subscription.py +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/services/imaging.py +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/services/media.py +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/services/media2.py +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/services/provisioning.py +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/services/ptz.py +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/services/receiver.py +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/services/recording.py +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/services/replay.py +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/services/schedule.py +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/services/search.py +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/services/security/advancedsecurity.py +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/services/security/authorizationserver.py +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/services/security/dot1x.py +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/services/security/jwt.py +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/services/security/keystore.py +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/services/security/mediasigning.py +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/services/security/tlsserver.py +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/services/thermal.py +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/services/uplink.py +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/utils/__init__.py +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/utils/error_handlers.py +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/utils/xml_capture.py +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/utils/zeep.py +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/accesscontrol/wsdl/index.html +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/accessrules/wsdl/accessrules.wsdl +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/accessrules/wsdl/index.html +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/actionengine.wsdl +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/advancedsecurity/wsdl/advancedsecurity.wsdl +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/advancedsecurity/wsdl/index.html +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/analyticsdevice.wsdl +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/appmgmt/wsdl/appmgmt.wsdl +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/appmgmt/wsdl/index.html +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/authenticationbehavior/wsdl/authenticationbehavior.wsdl +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/authenticationbehavior/wsdl/index.html +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/credential/wsdl/credential.wsdl +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/credential/wsdl/index.html +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/device/wsdl/devicemgmt.wsdl +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/deviceio.wsdl +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/display/display.wsdl +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/display/wsdl/index.htm +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/display.wsdl +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/doorcontrol/wsdl/index.html +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/events/wsdl/bw-2-vs-mod.wsdl +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/events/wsdl/event-vs.wsdl +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/events/wsdl/event.wsdl +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/events/wsdl/index.html +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/federatedsearch.wsdl +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/media/wsdl/media.wsdl +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/pacs/accesscontrol.wsdl +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/pacs/doorcontrol.wsdl +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/pacs/types.xsd +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/provisioning/wsdl/provisioning.wsdl +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/receiver.wsdl +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/recording.wsdl +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/replay.wsdl +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/schedule/wsdl/index.html +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/schedule/wsdl/schedule.wsdl +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/schema/common.xsd +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/schema/metadatastream.xsd +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/schema/onvif.xsd +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/search.wsdl +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/thermal/wsdl/index.html +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/thermal/wsdl/thermal.wsdl +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/topics/topicns.xml +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/uplink/wsdl/index.html +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver10/uplink/wsdl/uplink.wsdl +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver20/analytics/humanbody.xsd +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver20/analytics/humanface.xsd +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver20/analytics/index.html +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver20/analytics/radiometry.xsd +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver20/analytics/rules.xsd +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver20/analytics/wsdl/analytics.wsdl +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver20/analytics/wsdl/index.html +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver20/imaging/wsdl/imaging.wsdl +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver20/media/wsdl/index.html +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver20/media/wsdl/media.wsdl +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver20/ptz/wsdl/ptz.wsdl +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver20/util/federated_search_documentation.html +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver20/util/fedsearch-docu-viewer.xsl +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver20/util/onvif-wsdl-viewer.xsl +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif/wsdl/ver20/util/operationIndex.html +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif_python.egg-info/dependency_links.txt +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif_python.egg-info/requires.txt +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/onvif_python.egg-info/top_level.txt +0 -0
- {onvif_python-0.1.0 → onvif_python-0.1.1}/setup.cfg +0 -0
- {onvif_python-0.1.0 → 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.1.
|
|
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
|
[](https://github.com/nirsimetri/onvif-python?tab=MIT-1-ov-file)
|
|
42
42
|
[](https://deepwiki.com/nirsimetri/onvif-python)
|
|
43
|
-
[](https://github.com/nirsimetri/onvif-python/releases)
|
|
44
44
|
<br>
|
|
45
|
-
[](https://pypi.org/project/onvif-python/)
|
|
46
46
|
[](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/):
|
|
@@ -151,6 +158,73 @@ Explore more advanced usage and service-specific operations in the [`examples/`]
|
|
|
151
158
|
> [!IMPORTANT]
|
|
152
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.
|
|
153
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
|
+
|
|
154
228
|
## ONVIFClient Parameters
|
|
155
229
|
|
|
156
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:
|
|
@@ -193,9 +267,9 @@ The `ONVIFClient` class provides various configuration options to customize the
|
|
|
193
267
|
|
|
194
268
|
| Parameter | Type | Required | Default | Description |
|
|
195
269
|
|-----------|------|----------|---------|-------------|
|
|
196
|
-
| `apply_patch` | `bool` | ❌ No | `True` | Enable zeep patching for better `xsd:any` field parsing and automatic flattening, applied at (
|
|
197
|
-
| `capture_xml` | `bool` | ❌ No | `False` | Enable XML capture plugin for debugging SOAP requests/responses, applied at (
|
|
198
|
-
| `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 (
|
|
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)) |
|
|
199
273
|
|
|
200
274
|
</details>
|
|
201
275
|
|
|
@@ -428,53 +502,6 @@ else:
|
|
|
428
502
|
- **GetCapabilities** is **mandatory** for all ONVIF-compliant devices, ensuring broader compatibility
|
|
429
503
|
- **Default URLs** guarantee basic connectivity even with non-compliant devices
|
|
430
504
|
|
|
431
|
-
**Get detailed service information:**
|
|
432
|
-
|
|
433
|
-
If you need comprehensive service details, you can manually call `GetServices` with capabilities:
|
|
434
|
-
|
|
435
|
-
```python
|
|
436
|
-
device = client.devicemgmt()
|
|
437
|
-
|
|
438
|
-
try:
|
|
439
|
-
# Try to get detailed service information
|
|
440
|
-
services = device.GetServices(IncludeCapability=True)
|
|
441
|
-
for service in services:
|
|
442
|
-
print(f"Service: {service.Namespace}")
|
|
443
|
-
print(f"XAddr: {service.XAddr}")
|
|
444
|
-
if hasattr(service, 'Capabilities'):
|
|
445
|
-
print(f"Capabilities: {service.Capabilities}")
|
|
446
|
-
except Exception:
|
|
447
|
-
# Fallback to GetCapabilities for legacy devices
|
|
448
|
-
capabilities = device.GetCapabilities()
|
|
449
|
-
print("Capabilities:", capabilities)
|
|
450
|
-
```
|
|
451
|
-
|
|
452
|
-
**Access capabilities information:**
|
|
453
|
-
|
|
454
|
-
When using `GetCapabilities` fallback, you can access capability information:
|
|
455
|
-
|
|
456
|
-
```python
|
|
457
|
-
device = client.devicemgmt()
|
|
458
|
-
|
|
459
|
-
try:
|
|
460
|
-
# Get capabilities information from device
|
|
461
|
-
capabilities = device.GetCapabilities()
|
|
462
|
-
|
|
463
|
-
# Main services (always available)
|
|
464
|
-
print("Media XAddr:", getattr(capabilities.Media, 'XAddr', 'Not available'))
|
|
465
|
-
print("PTZ XAddr:", getattr(capabilities.PTZ, 'XAddr', 'Not available'))
|
|
466
|
-
|
|
467
|
-
# Extension services (device-dependent)
|
|
468
|
-
ext = getattr(capabilities, 'Extension', None)
|
|
469
|
-
if ext:
|
|
470
|
-
print("DeviceIO XAddr:", getattr(ext.DeviceIO, 'XAddr', 'Not available'))
|
|
471
|
-
print("Recording XAddr:", getattr(ext.Recording, 'XAddr', 'Not available'))
|
|
472
|
-
print("Search XAddr:", getattr(ext.Search, 'XAddr', 'Not available'))
|
|
473
|
-
print("Replay XAddr:", getattr(ext.Replay, 'XAddr', 'Not available'))
|
|
474
|
-
except Exception as e:
|
|
475
|
-
print(f"Error getting capabilities: {e}")
|
|
476
|
-
```
|
|
477
|
-
|
|
478
505
|
> [!TIP]
|
|
479
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.
|
|
480
507
|
|
|
@@ -630,8 +657,8 @@ Some ONVIF services have multiple bindings in the same WSDL. These typically inc
|
|
|
630
657
|
## Future Improvements (Stay tuned and star ⭐ this repo)
|
|
631
658
|
|
|
632
659
|
- [x] ~~Add debugging mode with raw xml on SOAP requests and responses.~~ ([c258162](https://github.com/nirsimetri/onvif-python/commit/c258162))
|
|
633
|
-
- [x] ~~Add functionality for `ONVIFClient` to accept a custom `wsdl_dir` service.~~ ([65f2570](https://github.com/nirsimetri/onvif-python/commit/
|
|
634
|
-
- [
|
|
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))
|
|
635
662
|
- [ ] Add asynchronous (async/await) support for non-blocking ONVIF operations and concurrent device communication.
|
|
636
663
|
- [ ] Implement structured data models for ONVIF Schemas using [xsdata](https://github.com/tefra/xsdata).
|
|
637
664
|
- [ ] Integrate [xmltodict](https://github.com/martinblech/xmltodict) for simplified XML parsing and conversion.
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://github.com/nirsimetri/onvif-python?tab=MIT-1-ov-file)
|
|
4
4
|
[](https://deepwiki.com/nirsimetri/onvif-python)
|
|
5
|
-
[](https://github.com/nirsimetri/onvif-python/releases)
|
|
6
6
|
<br>
|
|
7
|
-
[](https://pypi.org/project/onvif-python/)
|
|
8
8
|
[](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/):
|
|
@@ -113,6 +120,73 @@ Explore more advanced usage and service-specific operations in the [`examples/`]
|
|
|
113
120
|
> [!IMPORTANT]
|
|
114
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.
|
|
115
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
|
+
|
|
116
190
|
## ONVIFClient Parameters
|
|
117
191
|
|
|
118
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:
|
|
@@ -155,9 +229,9 @@ The `ONVIFClient` class provides various configuration options to customize the
|
|
|
155
229
|
|
|
156
230
|
| Parameter | Type | Required | Default | Description |
|
|
157
231
|
|-----------|------|----------|---------|-------------|
|
|
158
|
-
| `apply_patch` | `bool` | ❌ No | `True` | Enable zeep patching for better `xsd:any` field parsing and automatic flattening, applied at (
|
|
159
|
-
| `capture_xml` | `bool` | ❌ No | `False` | Enable XML capture plugin for debugging SOAP requests/responses, applied at (
|
|
160
|
-
| `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 (
|
|
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)) |
|
|
161
235
|
|
|
162
236
|
</details>
|
|
163
237
|
|
|
@@ -390,53 +464,6 @@ else:
|
|
|
390
464
|
- **GetCapabilities** is **mandatory** for all ONVIF-compliant devices, ensuring broader compatibility
|
|
391
465
|
- **Default URLs** guarantee basic connectivity even with non-compliant devices
|
|
392
466
|
|
|
393
|
-
**Get detailed service information:**
|
|
394
|
-
|
|
395
|
-
If you need comprehensive service details, you can manually call `GetServices` with capabilities:
|
|
396
|
-
|
|
397
|
-
```python
|
|
398
|
-
device = client.devicemgmt()
|
|
399
|
-
|
|
400
|
-
try:
|
|
401
|
-
# Try to get detailed service information
|
|
402
|
-
services = device.GetServices(IncludeCapability=True)
|
|
403
|
-
for service in services:
|
|
404
|
-
print(f"Service: {service.Namespace}")
|
|
405
|
-
print(f"XAddr: {service.XAddr}")
|
|
406
|
-
if hasattr(service, 'Capabilities'):
|
|
407
|
-
print(f"Capabilities: {service.Capabilities}")
|
|
408
|
-
except Exception:
|
|
409
|
-
# Fallback to GetCapabilities for legacy devices
|
|
410
|
-
capabilities = device.GetCapabilities()
|
|
411
|
-
print("Capabilities:", capabilities)
|
|
412
|
-
```
|
|
413
|
-
|
|
414
|
-
**Access capabilities information:**
|
|
415
|
-
|
|
416
|
-
When using `GetCapabilities` fallback, you can access capability information:
|
|
417
|
-
|
|
418
|
-
```python
|
|
419
|
-
device = client.devicemgmt()
|
|
420
|
-
|
|
421
|
-
try:
|
|
422
|
-
# Get capabilities information from device
|
|
423
|
-
capabilities = device.GetCapabilities()
|
|
424
|
-
|
|
425
|
-
# Main services (always available)
|
|
426
|
-
print("Media XAddr:", getattr(capabilities.Media, 'XAddr', 'Not available'))
|
|
427
|
-
print("PTZ XAddr:", getattr(capabilities.PTZ, 'XAddr', 'Not available'))
|
|
428
|
-
|
|
429
|
-
# Extension services (device-dependent)
|
|
430
|
-
ext = getattr(capabilities, 'Extension', None)
|
|
431
|
-
if ext:
|
|
432
|
-
print("DeviceIO XAddr:", getattr(ext.DeviceIO, 'XAddr', 'Not available'))
|
|
433
|
-
print("Recording XAddr:", getattr(ext.Recording, 'XAddr', 'Not available'))
|
|
434
|
-
print("Search XAddr:", getattr(ext.Search, 'XAddr', 'Not available'))
|
|
435
|
-
print("Replay XAddr:", getattr(ext.Replay, 'XAddr', 'Not available'))
|
|
436
|
-
except Exception as e:
|
|
437
|
-
print(f"Error getting capabilities: {e}")
|
|
438
|
-
```
|
|
439
|
-
|
|
440
467
|
> [!TIP]
|
|
441
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.
|
|
442
469
|
|
|
@@ -592,8 +619,8 @@ Some ONVIF services have multiple bindings in the same WSDL. These typically inc
|
|
|
592
619
|
## Future Improvements (Stay tuned and star ⭐ this repo)
|
|
593
620
|
|
|
594
621
|
- [x] ~~Add debugging mode with raw xml on SOAP requests and responses.~~ ([c258162](https://github.com/nirsimetri/onvif-python/commit/c258162))
|
|
595
|
-
- [x] ~~Add functionality for `ONVIFClient` to accept a custom `wsdl_dir` service.~~ ([65f2570](https://github.com/nirsimetri/onvif-python/commit/
|
|
596
|
-
- [
|
|
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))
|
|
597
624
|
- [ ] Add asynchronous (async/await) support for non-blocking ONVIF operations and concurrent device communication.
|
|
598
625
|
- [ ] Implement structured data models for ONVIF Schemas using [xsdata](https://github.com/tefra/xsdata).
|
|
599
626
|
- [ ] Integrate [xmltodict](https://github.com/martinblech/xmltodict) for simplified XML parsing and conversion.
|
|
@@ -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")
|