onvif-python 0.0.5__tar.gz → 0.0.7__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.0.5/onvif_python.egg-info → onvif_python-0.0.7}/PKG-INFO +196 -8
- {onvif_python-0.0.5 → onvif_python-0.0.7}/README.md +191 -5
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/__init__.py +3 -5
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/client.py +44 -41
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/operator.py +5 -4
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/services/accesscontrol.py +5 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/services/accessrules.py +5 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/services/actionengine.py +5 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/services/analytics/analytics.py +5 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/services/analytics/ruleengine.py +5 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/services/analyticsdevice.py +4 -3
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/services/appmgmt.py +5 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/services/authenticationbehavior.py +5 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/services/credential.py +5 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/services/deviceio.py +5 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/services/devicemgmt.py +5 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/services/display.py +5 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/services/doorcontrol.py +5 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/services/events/events.py +5 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/services/events/notification.py +4 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/services/events/pullpoint.py +4 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/services/events/subscription.py +4 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/services/imaging.py +8 -1
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/services/media.py +5 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/services/media2.py +5 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/services/provisioning.py +5 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/services/ptz.py +5 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/services/receiver.py +5 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/services/recording.py +5 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/services/replay.py +5 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/services/schedule.py +5 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/services/search.py +5 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/services/security/advancedsecurity.py +5 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/services/security/authorizationserver.py +5 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/services/security/dot1x.py +5 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/services/security/jwt.py +5 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/services/security/keystore.py +5 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/services/security/mediasigning.py +5 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/services/security/tlsserver.py +5 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/services/thermal.py +5 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/services/uplink.py +5 -0
- onvif_python-0.0.7/onvif/utils/__init__.py +14 -0
- onvif_python-0.0.7/onvif/utils/error_handlers.py +76 -0
- onvif_python-0.0.7/onvif/utils/exceptions.py +69 -0
- onvif_python-0.0.7/onvif/utils/xml_capture.py +110 -0
- onvif_python-0.0.7/onvif/utils/zeep.py +385 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/schema/onvif.xsd +1 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7/onvif_python.egg-info}/PKG-INFO +196 -8
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif_python.egg-info/SOURCES.txt +2 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/pyproject.toml +5 -3
- onvif_python-0.0.5/onvif/utils/__init__.py +0 -4
- onvif_python-0.0.5/onvif/utils/exceptions.py +0 -33
- onvif_python-0.0.5/onvif/utils/zeep.py +0 -272
- {onvif_python-0.0.5 → onvif_python-0.0.7}/LICENSE.md +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/MANIFEST.in +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/services/__init__.py +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/utils/wsdl.py +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/accesscontrol/wsdl/index.html +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/accessrules/wsdl/accessrules.wsdl +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/accessrules/wsdl/index.html +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/actionengine.wsdl +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/advancedsecurity/wsdl/advancedsecurity.wsdl +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/advancedsecurity/wsdl/index.html +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/analyticsdevice.wsdl +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/appmgmt/wsdl/appmgmt.wsdl +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/appmgmt/wsdl/index.html +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/authenticationbehavior/wsdl/authenticationbehavior.wsdl +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/authenticationbehavior/wsdl/index.html +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/credential/wsdl/credential.wsdl +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/credential/wsdl/index.html +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/device/wsdl/devicemgmt.wsdl +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/deviceio.wsdl +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/display/display.wsdl +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/display/wsdl/index.htm +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/display.wsdl +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/doorcontrol/wsdl/index.html +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/events/wsdl/bw-2-vs-mod.wsdl +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/events/wsdl/event-vs.wsdl +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/events/wsdl/event.wsdl +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/events/wsdl/index.html +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/federatedsearch.wsdl +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/media/wsdl/media.wsdl +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/pacs/accesscontrol.wsdl +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/pacs/doorcontrol.wsdl +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/pacs/types.xsd +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/provisioning/wsdl/provisioning.wsdl +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/receiver.wsdl +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/recording.wsdl +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/replay.wsdl +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/schedule/wsdl/index.html +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/schedule/wsdl/schedule.wsdl +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/schema/common.xsd +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/schema/metadatastream.xsd +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/search.wsdl +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/thermal/wsdl/index.html +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/thermal/wsdl/thermal.wsdl +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/topics/topicns.xml +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/uplink/wsdl/index.html +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver10/uplink/wsdl/uplink.wsdl +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver20/analytics/humanbody.xsd +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver20/analytics/humanface.xsd +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver20/analytics/index.html +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver20/analytics/radiometry.xsd +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver20/analytics/rules.xsd +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver20/analytics/wsdl/analytics.wsdl +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver20/analytics/wsdl/index.html +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver20/imaging/wsdl/imaging.wsdl +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver20/media/wsdl/index.html +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver20/media/wsdl/media.wsdl +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver20/ptz/wsdl/ptz.wsdl +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver20/util/federated_search_documentation.html +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver20/util/fedsearch-docu-viewer.xsl +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver20/util/onvif-wsdl-viewer.xsl +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif/wsdl/ver20/util/operationIndex.html +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif_python.egg-info/dependency_links.txt +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif_python.egg-info/requires.txt +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/onvif_python.egg-info/top_level.txt +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/setup.cfg +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/setup.py +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/tests/test_client.py +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/tests/test_core.py +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/tests/test_exceptions.py +0 -0
- {onvif_python-0.0.5 → onvif_python-0.0.7}/tests/test_wsdl_map.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: onvif-python
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.7
|
|
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
|
|
@@ -10,8 +10,8 @@ Project-URL: Issues, https://github.com/nirsimetri/onvif-python/issues
|
|
|
10
10
|
Project-URL: Documentation, https://deepwiki.com/nirsimetri/onvif-python
|
|
11
11
|
Project-URL: Repository, https://github.com/nirsimetri/onvif-python.git
|
|
12
12
|
Project-URL: Changelog, https://github.com/nirsimetri/onvif-python/releases
|
|
13
|
-
Keywords:
|
|
14
|
-
Classifier: Development Status ::
|
|
13
|
+
Keywords: onvif,Camera,onvif-python,ip-camera,cctv,soap,surveillance,cctv cameras,soap-client,onvif-client,onvif-library,onvif-specifications
|
|
14
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
15
15
|
Classifier: Environment :: Console
|
|
16
16
|
Classifier: Programming Language :: Python :: 3
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.9
|
|
@@ -25,7 +25,9 @@ Classifier: Topic :: Security
|
|
|
25
25
|
Classifier: Topic :: Multimedia :: Video
|
|
26
26
|
Classifier: Topic :: Multimedia :: Sound/Audio
|
|
27
27
|
Classifier: Topic :: Communications
|
|
28
|
+
Classifier: Topic :: Text Processing :: Markup :: XML
|
|
28
29
|
Classifier: Natural Language :: English
|
|
30
|
+
Classifier: Natural Language :: Indonesian
|
|
29
31
|
Requires-Python: >=3.9
|
|
30
32
|
Description-Content-Type: text/markdown
|
|
31
33
|
License-File: LICENSE.md
|
|
@@ -41,9 +43,9 @@ Dynamic: license-file
|
|
|
41
43
|
|
|
42
44
|
[](https://github.com/nirsimetri/onvif-python?tab=MIT-1-ov-file)
|
|
43
45
|
[](https://deepwiki.com/nirsimetri/onvif-python)
|
|
44
|
-
[](https://github.com/nirsimetri/onvif-python/releases)
|
|
45
47
|
<br>
|
|
46
|
-
[](https://pypi.org/project/onvif-python/)
|
|
47
49
|
[](https://clickpy.clickhouse.com/dashboard/onvif-python)
|
|
48
50
|
|
|
49
51
|
Are you having trouble finding a Python ONVIF library that supports your device?
|
|
@@ -148,6 +150,191 @@ Explore more advanced usage and service-specific operations in the [`examples/`]
|
|
|
148
150
|
> [!IMPORTANT]
|
|
149
151
|
> 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.
|
|
150
152
|
|
|
153
|
+
## ONVIFClient Parameters
|
|
154
|
+
|
|
155
|
+
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:
|
|
156
|
+
|
|
157
|
+
### Basic Parameters
|
|
158
|
+
|
|
159
|
+
| Parameter | Type | Required | Default | Description |
|
|
160
|
+
|-----------|------|----------|---------|-------------|
|
|
161
|
+
| `host` | `str` | ✅ Yes | - | IP address or hostname of the ONVIF device (e.g., `"192.168.1.17"`) |
|
|
162
|
+
| `port` | `int` | ✅ Yes | - | Port number for ONVIF service (common ports: `80`, `8000`, `8080`) |
|
|
163
|
+
| `username` | `str` | ✅ Yes | - | Username for device authentication (use digest authentication) |
|
|
164
|
+
| `password` | `str` | ✅ Yes | - | Password for device authentication |
|
|
165
|
+
|
|
166
|
+
### Connection Parameters
|
|
167
|
+
|
|
168
|
+
| Parameter | Type | Required | Default | Description |
|
|
169
|
+
|-----------|------|----------|---------|-------------|
|
|
170
|
+
| `timeout` | `int` | ❌ No | `10` | Connection timeout in seconds for SOAP requests |
|
|
171
|
+
| `use_https` | `bool` | ❌ No | `False` | Use HTTPS instead of HTTP for secure communication |
|
|
172
|
+
| `verify_ssl` | `bool` | ❌ No | `True` | Verify SSL certificates when using HTTPS (set to `False` for self-signed certificates) |
|
|
173
|
+
|
|
174
|
+
### Caching Parameters
|
|
175
|
+
|
|
176
|
+
| Parameter | Type | Required | Default | Description |
|
|
177
|
+
|-----------|------|----------|---------|-------------|
|
|
178
|
+
| `cache` | `CacheMode` | ❌ No | `CacheMode.ALL` | WSDL caching strategy (see [Cache Modes](#cache-modes) below) |
|
|
179
|
+
|
|
180
|
+
### Feature Parameters
|
|
181
|
+
|
|
182
|
+
| Parameter | Type | Required | Default | Description |
|
|
183
|
+
|-----------|------|----------|---------|-------------|
|
|
184
|
+
| `apply_patch` | `bool` | ❌ No | `True` | Enable zeep patching for better xsd:any field parsing and automatic flattening |
|
|
185
|
+
| `capture_xml` | `bool` | ❌ No | `False` | Enable XML capture plugin for debugging SOAP requests/responses |
|
|
186
|
+
|
|
187
|
+
### Cache Modes
|
|
188
|
+
|
|
189
|
+
The library provides four caching strategies via the `CacheMode` enum:
|
|
190
|
+
|
|
191
|
+
| Mode | Description | Best For | Startup Speed | Disk Usage | Memory Usage |
|
|
192
|
+
|------|-------------|----------|---------------|------------|--------------|
|
|
193
|
+
| `CacheMode.ALL` | In-memory + disk cache (SQLite) | Production servers, multi-device apps | ⚡⚡⚡ Fast | 💾 High | 🧠 High |
|
|
194
|
+
| `CacheMode.DB` | Disk cache only (SQLite) | Batch jobs, CLI tools | ⚡⚡ Medium | 💾 Medium | 🧠 Low |
|
|
195
|
+
| `CacheMode.MEM` | In-memory cache only | Short-lived scripts, demos | ⚡⚡ Medium | 💾 None | 🧠 Medium |
|
|
196
|
+
| `CacheMode.NONE` | No caching | Testing, debugging | ⚡ Slow | 💾 None | 🧠 Low |
|
|
197
|
+
|
|
198
|
+
**Recommendation:** Use `CacheMode.ALL` (default) for production applications to maximize performance.
|
|
199
|
+
|
|
200
|
+
### Usage Examples
|
|
201
|
+
|
|
202
|
+
**Basic Connection:**
|
|
203
|
+
```python
|
|
204
|
+
from onvif import ONVIFClient
|
|
205
|
+
|
|
206
|
+
# Minimal configuration
|
|
207
|
+
client = ONVIFClient("192.168.1.17", 80, "admin", "password")
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
**Secure Connection (HTTPS):**
|
|
211
|
+
```python
|
|
212
|
+
from onvif import ONVIFClient
|
|
213
|
+
|
|
214
|
+
# Connect via HTTPS with custom timeout
|
|
215
|
+
client = ONVIFClient(
|
|
216
|
+
"your-cctv-node.viewplexus.com",
|
|
217
|
+
443, # HTTPS port
|
|
218
|
+
"admin",
|
|
219
|
+
"password",
|
|
220
|
+
timeout=30,
|
|
221
|
+
use_https=True,
|
|
222
|
+
verify_ssl=False # For self-signed certificates
|
|
223
|
+
)
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
**Performance Optimized (Memory Cache):**
|
|
227
|
+
```python
|
|
228
|
+
from onvif import ONVIFClient, CacheMode
|
|
229
|
+
|
|
230
|
+
# Use memory-only cache for quick scripts
|
|
231
|
+
client = ONVIFClient(
|
|
232
|
+
"192.168.1.17",
|
|
233
|
+
80,
|
|
234
|
+
"admin",
|
|
235
|
+
"password",
|
|
236
|
+
cache=CacheMode.MEM
|
|
237
|
+
)
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
**No Caching (Testing):**
|
|
241
|
+
```python
|
|
242
|
+
from onvif import ONVIFClient, CacheMode
|
|
243
|
+
|
|
244
|
+
# Disable all caching for testing
|
|
245
|
+
client = ONVIFClient(
|
|
246
|
+
"192.168.1.17",
|
|
247
|
+
80,
|
|
248
|
+
"admin",
|
|
249
|
+
"password",
|
|
250
|
+
cache=CacheMode.NONE,
|
|
251
|
+
apply_patch=False # Use original zeep behavior
|
|
252
|
+
)
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
**Debugging Mode (XML Capture):**
|
|
256
|
+
```python
|
|
257
|
+
from onvif import ONVIFClient
|
|
258
|
+
|
|
259
|
+
# Enable XML capture for debugging
|
|
260
|
+
client = ONVIFClient(
|
|
261
|
+
"192.168.1.17",
|
|
262
|
+
80,
|
|
263
|
+
"admin",
|
|
264
|
+
"password",
|
|
265
|
+
capture_xml=True # Captures all SOAP requests/responses
|
|
266
|
+
)
|
|
267
|
+
|
|
268
|
+
# Make some ONVIF calls
|
|
269
|
+
device = client.devicemgmt()
|
|
270
|
+
info = device.GetDeviceInformation()
|
|
271
|
+
services = device.GetCapabilities()
|
|
272
|
+
|
|
273
|
+
# Access the XML capture plugin
|
|
274
|
+
if client.xml_plugin:
|
|
275
|
+
# Get last captured request/response
|
|
276
|
+
print("Last Request XML:")
|
|
277
|
+
print(client.xml_plugin.last_sent_xml)
|
|
278
|
+
|
|
279
|
+
print("\nLast Response XML:")
|
|
280
|
+
print(client.xml_plugin.last_received_xml)
|
|
281
|
+
|
|
282
|
+
print(f"\nLast Operation: {client.xml_plugin.last_operation}")
|
|
283
|
+
|
|
284
|
+
# Get complete history of all requests/responses
|
|
285
|
+
print(f"\nTotal captured operations: {len(client.xml_plugin.history)}")
|
|
286
|
+
for item in client.xml_plugin.history:
|
|
287
|
+
print(f" - {item['operation']} ({item['type']})")
|
|
288
|
+
|
|
289
|
+
# Save captured XML to files
|
|
290
|
+
client.xml_plugin.save_to_file(
|
|
291
|
+
request_file="last_request.xml",
|
|
292
|
+
response_file="last_response.xml"
|
|
293
|
+
)
|
|
294
|
+
|
|
295
|
+
# Clear history when done
|
|
296
|
+
client.xml_plugin.clear_history()
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
> [!NOTE]
|
|
300
|
+
> **XML Capture Plugin Methods:**
|
|
301
|
+
> - `last_sent_xml` - Get the last SOAP request XML
|
|
302
|
+
> - `last_received_xml` - Get the last SOAP response XML
|
|
303
|
+
> - `last_operation` - Get the name of the last operation
|
|
304
|
+
> - `history` - List of all captured requests/responses with metadata
|
|
305
|
+
> - `get_last_request()` - Method to get last request
|
|
306
|
+
> - `get_last_response()` - Method to get last response
|
|
307
|
+
> - `get_history()` - Method to get all history
|
|
308
|
+
> - `save_to_file(request_file, response_file)` - Save XML to files
|
|
309
|
+
> - `clear_history()` - Clear captured history
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
**Production Configuration:**
|
|
313
|
+
```python
|
|
314
|
+
from onvif import ONVIFClient, CacheMode
|
|
315
|
+
|
|
316
|
+
# Recommended production settings
|
|
317
|
+
client = ONVIFClient(
|
|
318
|
+
host="your-cctv-node.viewplexus.com",
|
|
319
|
+
port=443,
|
|
320
|
+
username="admin",
|
|
321
|
+
password="secure_password",
|
|
322
|
+
timeout=15,
|
|
323
|
+
cache=CacheMode.ALL, # Maximum performance
|
|
324
|
+
use_https=True, # Secure communication
|
|
325
|
+
verify_ssl=True, # Verify certificates (default)
|
|
326
|
+
apply_patch=True, # Enhanced parsing (default)
|
|
327
|
+
capture_xml=False # Disable debug mode (default)
|
|
328
|
+
)
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
### Notes
|
|
332
|
+
|
|
333
|
+
- **Authentication:** This library uses **WS-UsernameToken with Digest** authentication by default, which is the standard for ONVIF devices.
|
|
334
|
+
- **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.
|
|
335
|
+
- **XML Capture:** Only use `capture_xml=True` during development/debugging as it increases memory usage and may expose sensitive data in logs.
|
|
336
|
+
- **Cache Location:** Disk cache (when using `CacheMode.DB` or `CacheMode.ALL`) is stored in `~/.onvif-python/onvif_zeep_cache.sqlite`.
|
|
337
|
+
|
|
151
338
|
## Service Discovery: Understanding Device Capabilities
|
|
152
339
|
|
|
153
340
|
> [!WARNING]
|
|
@@ -358,11 +545,12 @@ Some ONVIF services have multiple bindings in the same WSDL. These typically inc
|
|
|
358
545
|
|
|
359
546
|
## Future Improvements (Stay tuned and star ⭐ this repo)
|
|
360
547
|
|
|
361
|
-
- [
|
|
548
|
+
- [x] Add debugging mode with raw xml on SOAP requests and responses. ([c258162](https://github.com/nirsimetri/onvif-python/commit/c258162))
|
|
549
|
+
- [ ] Add functionality for `ONVIFClient` to accept a custom `wsdl_path` service.
|
|
550
|
+
- [ ] Add asynchronous (async/await) support for non-blocking ONVIF operations and concurrent device communication.
|
|
551
|
+
- [ ] Add `ONVIF CLI` program to interact directly with ONVIF devices via terminal.
|
|
362
552
|
- [ ] Implement structured data models for ONVIF Schemas using [xsdata](https://github.com/tefra/xsdata).
|
|
363
553
|
- [ ] Integrate [xmltodict](https://github.com/martinblech/xmltodict) for simplified XML parsing and conversion.
|
|
364
|
-
- [ ] Add functionality for `ONVIFClient` to accept a custom `wsdl_path` service.
|
|
365
|
-
- [ ] Add debugging mode with raw xml on SOAP requests and responses.
|
|
366
554
|
- [ ] Enhance documentation with API references and diagrams (not from [AI Wiki](https://deepwiki.com/nirsimetri/onvif-python)).
|
|
367
555
|
- [ ] Add more usage examples for advanced features.
|
|
368
556
|
- [ ] Add benchmarking and performance metrics.
|
|
@@ -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
|
Are you having trouble finding a Python ONVIF library that supports your device?
|
|
@@ -109,6 +109,191 @@ Explore more advanced usage and service-specific operations in the [`examples/`]
|
|
|
109
109
|
> [!IMPORTANT]
|
|
110
110
|
> 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.
|
|
111
111
|
|
|
112
|
+
## ONVIFClient Parameters
|
|
113
|
+
|
|
114
|
+
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:
|
|
115
|
+
|
|
116
|
+
### Basic Parameters
|
|
117
|
+
|
|
118
|
+
| Parameter | Type | Required | Default | Description |
|
|
119
|
+
|-----------|------|----------|---------|-------------|
|
|
120
|
+
| `host` | `str` | ✅ Yes | - | IP address or hostname of the ONVIF device (e.g., `"192.168.1.17"`) |
|
|
121
|
+
| `port` | `int` | ✅ Yes | - | Port number for ONVIF service (common ports: `80`, `8000`, `8080`) |
|
|
122
|
+
| `username` | `str` | ✅ Yes | - | Username for device authentication (use digest authentication) |
|
|
123
|
+
| `password` | `str` | ✅ Yes | - | Password for device authentication |
|
|
124
|
+
|
|
125
|
+
### Connection Parameters
|
|
126
|
+
|
|
127
|
+
| Parameter | Type | Required | Default | Description |
|
|
128
|
+
|-----------|------|----------|---------|-------------|
|
|
129
|
+
| `timeout` | `int` | ❌ No | `10` | Connection timeout in seconds for SOAP requests |
|
|
130
|
+
| `use_https` | `bool` | ❌ No | `False` | Use HTTPS instead of HTTP for secure communication |
|
|
131
|
+
| `verify_ssl` | `bool` | ❌ No | `True` | Verify SSL certificates when using HTTPS (set to `False` for self-signed certificates) |
|
|
132
|
+
|
|
133
|
+
### Caching Parameters
|
|
134
|
+
|
|
135
|
+
| Parameter | Type | Required | Default | Description |
|
|
136
|
+
|-----------|------|----------|---------|-------------|
|
|
137
|
+
| `cache` | `CacheMode` | ❌ No | `CacheMode.ALL` | WSDL caching strategy (see [Cache Modes](#cache-modes) below) |
|
|
138
|
+
|
|
139
|
+
### Feature Parameters
|
|
140
|
+
|
|
141
|
+
| Parameter | Type | Required | Default | Description |
|
|
142
|
+
|-----------|------|----------|---------|-------------|
|
|
143
|
+
| `apply_patch` | `bool` | ❌ No | `True` | Enable zeep patching for better xsd:any field parsing and automatic flattening |
|
|
144
|
+
| `capture_xml` | `bool` | ❌ No | `False` | Enable XML capture plugin for debugging SOAP requests/responses |
|
|
145
|
+
|
|
146
|
+
### Cache Modes
|
|
147
|
+
|
|
148
|
+
The library provides four caching strategies via the `CacheMode` enum:
|
|
149
|
+
|
|
150
|
+
| Mode | Description | Best For | Startup Speed | Disk Usage | Memory Usage |
|
|
151
|
+
|------|-------------|----------|---------------|------------|--------------|
|
|
152
|
+
| `CacheMode.ALL` | In-memory + disk cache (SQLite) | Production servers, multi-device apps | ⚡⚡⚡ Fast | 💾 High | 🧠 High |
|
|
153
|
+
| `CacheMode.DB` | Disk cache only (SQLite) | Batch jobs, CLI tools | ⚡⚡ Medium | 💾 Medium | 🧠 Low |
|
|
154
|
+
| `CacheMode.MEM` | In-memory cache only | Short-lived scripts, demos | ⚡⚡ Medium | 💾 None | 🧠 Medium |
|
|
155
|
+
| `CacheMode.NONE` | No caching | Testing, debugging | ⚡ Slow | 💾 None | 🧠 Low |
|
|
156
|
+
|
|
157
|
+
**Recommendation:** Use `CacheMode.ALL` (default) for production applications to maximize performance.
|
|
158
|
+
|
|
159
|
+
### Usage Examples
|
|
160
|
+
|
|
161
|
+
**Basic Connection:**
|
|
162
|
+
```python
|
|
163
|
+
from onvif import ONVIFClient
|
|
164
|
+
|
|
165
|
+
# Minimal configuration
|
|
166
|
+
client = ONVIFClient("192.168.1.17", 80, "admin", "password")
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
**Secure Connection (HTTPS):**
|
|
170
|
+
```python
|
|
171
|
+
from onvif import ONVIFClient
|
|
172
|
+
|
|
173
|
+
# Connect via HTTPS with custom timeout
|
|
174
|
+
client = ONVIFClient(
|
|
175
|
+
"your-cctv-node.viewplexus.com",
|
|
176
|
+
443, # HTTPS port
|
|
177
|
+
"admin",
|
|
178
|
+
"password",
|
|
179
|
+
timeout=30,
|
|
180
|
+
use_https=True,
|
|
181
|
+
verify_ssl=False # For self-signed certificates
|
|
182
|
+
)
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
**Performance Optimized (Memory Cache):**
|
|
186
|
+
```python
|
|
187
|
+
from onvif import ONVIFClient, CacheMode
|
|
188
|
+
|
|
189
|
+
# Use memory-only cache for quick scripts
|
|
190
|
+
client = ONVIFClient(
|
|
191
|
+
"192.168.1.17",
|
|
192
|
+
80,
|
|
193
|
+
"admin",
|
|
194
|
+
"password",
|
|
195
|
+
cache=CacheMode.MEM
|
|
196
|
+
)
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
**No Caching (Testing):**
|
|
200
|
+
```python
|
|
201
|
+
from onvif import ONVIFClient, CacheMode
|
|
202
|
+
|
|
203
|
+
# Disable all caching for testing
|
|
204
|
+
client = ONVIFClient(
|
|
205
|
+
"192.168.1.17",
|
|
206
|
+
80,
|
|
207
|
+
"admin",
|
|
208
|
+
"password",
|
|
209
|
+
cache=CacheMode.NONE,
|
|
210
|
+
apply_patch=False # Use original zeep behavior
|
|
211
|
+
)
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
**Debugging Mode (XML Capture):**
|
|
215
|
+
```python
|
|
216
|
+
from onvif import ONVIFClient
|
|
217
|
+
|
|
218
|
+
# Enable XML capture for debugging
|
|
219
|
+
client = ONVIFClient(
|
|
220
|
+
"192.168.1.17",
|
|
221
|
+
80,
|
|
222
|
+
"admin",
|
|
223
|
+
"password",
|
|
224
|
+
capture_xml=True # Captures all SOAP requests/responses
|
|
225
|
+
)
|
|
226
|
+
|
|
227
|
+
# Make some ONVIF calls
|
|
228
|
+
device = client.devicemgmt()
|
|
229
|
+
info = device.GetDeviceInformation()
|
|
230
|
+
services = device.GetCapabilities()
|
|
231
|
+
|
|
232
|
+
# Access the XML capture plugin
|
|
233
|
+
if client.xml_plugin:
|
|
234
|
+
# Get last captured request/response
|
|
235
|
+
print("Last Request XML:")
|
|
236
|
+
print(client.xml_plugin.last_sent_xml)
|
|
237
|
+
|
|
238
|
+
print("\nLast Response XML:")
|
|
239
|
+
print(client.xml_plugin.last_received_xml)
|
|
240
|
+
|
|
241
|
+
print(f"\nLast Operation: {client.xml_plugin.last_operation}")
|
|
242
|
+
|
|
243
|
+
# Get complete history of all requests/responses
|
|
244
|
+
print(f"\nTotal captured operations: {len(client.xml_plugin.history)}")
|
|
245
|
+
for item in client.xml_plugin.history:
|
|
246
|
+
print(f" - {item['operation']} ({item['type']})")
|
|
247
|
+
|
|
248
|
+
# Save captured XML to files
|
|
249
|
+
client.xml_plugin.save_to_file(
|
|
250
|
+
request_file="last_request.xml",
|
|
251
|
+
response_file="last_response.xml"
|
|
252
|
+
)
|
|
253
|
+
|
|
254
|
+
# Clear history when done
|
|
255
|
+
client.xml_plugin.clear_history()
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
> [!NOTE]
|
|
259
|
+
> **XML Capture Plugin Methods:**
|
|
260
|
+
> - `last_sent_xml` - Get the last SOAP request XML
|
|
261
|
+
> - `last_received_xml` - Get the last SOAP response XML
|
|
262
|
+
> - `last_operation` - Get the name of the last operation
|
|
263
|
+
> - `history` - List of all captured requests/responses with metadata
|
|
264
|
+
> - `get_last_request()` - Method to get last request
|
|
265
|
+
> - `get_last_response()` - Method to get last response
|
|
266
|
+
> - `get_history()` - Method to get all history
|
|
267
|
+
> - `save_to_file(request_file, response_file)` - Save XML to files
|
|
268
|
+
> - `clear_history()` - Clear captured history
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
**Production Configuration:**
|
|
272
|
+
```python
|
|
273
|
+
from onvif import ONVIFClient, CacheMode
|
|
274
|
+
|
|
275
|
+
# Recommended production settings
|
|
276
|
+
client = ONVIFClient(
|
|
277
|
+
host="your-cctv-node.viewplexus.com",
|
|
278
|
+
port=443,
|
|
279
|
+
username="admin",
|
|
280
|
+
password="secure_password",
|
|
281
|
+
timeout=15,
|
|
282
|
+
cache=CacheMode.ALL, # Maximum performance
|
|
283
|
+
use_https=True, # Secure communication
|
|
284
|
+
verify_ssl=True, # Verify certificates (default)
|
|
285
|
+
apply_patch=True, # Enhanced parsing (default)
|
|
286
|
+
capture_xml=False # Disable debug mode (default)
|
|
287
|
+
)
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
### Notes
|
|
291
|
+
|
|
292
|
+
- **Authentication:** This library uses **WS-UsernameToken with Digest** authentication by default, which is the standard for ONVIF devices.
|
|
293
|
+
- **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.
|
|
294
|
+
- **XML Capture:** Only use `capture_xml=True` during development/debugging as it increases memory usage and may expose sensitive data in logs.
|
|
295
|
+
- **Cache Location:** Disk cache (when using `CacheMode.DB` or `CacheMode.ALL`) is stored in `~/.onvif-python/onvif_zeep_cache.sqlite`.
|
|
296
|
+
|
|
112
297
|
## Service Discovery: Understanding Device Capabilities
|
|
113
298
|
|
|
114
299
|
> [!WARNING]
|
|
@@ -319,11 +504,12 @@ Some ONVIF services have multiple bindings in the same WSDL. These typically inc
|
|
|
319
504
|
|
|
320
505
|
## Future Improvements (Stay tuned and star ⭐ this repo)
|
|
321
506
|
|
|
322
|
-
- [
|
|
507
|
+
- [x] Add debugging mode with raw xml on SOAP requests and responses. ([c258162](https://github.com/nirsimetri/onvif-python/commit/c258162))
|
|
508
|
+
- [ ] Add functionality for `ONVIFClient` to accept a custom `wsdl_path` service.
|
|
509
|
+
- [ ] Add asynchronous (async/await) support for non-blocking ONVIF operations and concurrent device communication.
|
|
510
|
+
- [ ] Add `ONVIF CLI` program to interact directly with ONVIF devices via terminal.
|
|
323
511
|
- [ ] Implement structured data models for ONVIF Schemas using [xsdata](https://github.com/tefra/xsdata).
|
|
324
512
|
- [ ] Integrate [xmltodict](https://github.com/martinblech/xmltodict) for simplified XML parsing and conversion.
|
|
325
|
-
- [ ] Add functionality for `ONVIFClient` to accept a custom `wsdl_path` service.
|
|
326
|
-
- [ ] Add debugging mode with raw xml on SOAP requests and responses.
|
|
327
513
|
- [ ] Enhance documentation with API references and diagrams (not from [AI Wiki](https://deepwiki.com/nirsimetri/onvif-python)).
|
|
328
514
|
- [ ] Add more usage examples for advanced features.
|
|
329
515
|
- [ ] Add benchmarking and performance metrics.
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from .client import ONVIFClient
|
|
4
4
|
from .operator import ONVIFOperator, CacheMode
|
|
5
|
-
from .utils import ONVIFWSDL, ONVIFOperationException
|
|
6
|
-
from .utils.zeep import apply_patch, remove_patch, is_patched
|
|
5
|
+
from .utils import ONVIFWSDL, ONVIFOperationException, ONVIFErrorHandler, ZeepPatcher
|
|
7
6
|
|
|
8
7
|
__all__ = [
|
|
9
8
|
"ONVIFClient",
|
|
@@ -11,7 +10,6 @@ __all__ = [
|
|
|
11
10
|
"CacheMode",
|
|
12
11
|
"ONVIFWSDL",
|
|
13
12
|
"ONVIFOperationException",
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"is_patched",
|
|
13
|
+
"ONVIFErrorHandler",
|
|
14
|
+
"ZeepPatcher",
|
|
17
15
|
]
|