Skip to content

Commit e259ab7

Browse files
authored
Release 0.2.11
2 parents 0c417c7 + 8642c47 commit e259ab7

100 files changed

Lines changed: 1950 additions & 775 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*.env
55
.env
66
venv/
7+
.mypy_cache/
78

89
# Distribution / packaging
910
build/

‎.pylintrc‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[MAIN]
2+
extension-pkg-allow-list=lxml
3+
max-line-length = 190

‎CONTRIBUTING.md‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,20 +61,26 @@ All contributors are expected to follow our [Code of Conduct](./CODE_OF_CONDUCT.
6161
# Install the package in development mode
6262
pip install -e .
6363

64-
# Install development dependencies (pytest, black, flake8)
64+
# Install development dependencies (pytest, black, flake8, mypy, isort, pylint)
6565
pip install -e ".[dev]"
6666
```
6767
Or use `pyproject.toml` with your preferred tool (e.g., Poetry, pip).
6868
3. **Run tests:**
6969
```bash
70-
pytest
70+
python -m pytest
7171
```
7272
Make sure all tests pass before submitting your changes.
7373

7474
4. **Lint and format code:**
7575
```bash
7676
# Check code style with flake8
7777
flake8 .
78+
79+
# Check code linting with pylint
80+
pylint .
81+
82+
# Sort import order
83+
isort .
7884

7985
# Format code with black
8086
black .

‎README.md‎

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<div align="center">
44
<a href="https://app.codacy.com/gh/nirsimetri/onvif-python/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade"><img src="https://app.codacy.com/project/badge/Grade/bff08a94e4d447b690cea49c6594826d"/></a>
55
<a href="https://deepwiki.com/nirsimetri/onvif-python"><img alt="Ask DeepWiki" src="https://deepwiki.com/badge.svg"></a>
6-
<a href="https://pypi.org/project/onvif-python/"><img alt="PyPI Version" src="https://img.shields.io/badge/PyPI-0.2.10-orange?logo=archive&color=yellow"></a>
6+
<a href="https://pypi.org/project/onvif-python/"><img alt="PyPI Version" src="https://img.shields.io/badge/PyPI-0.2.11-orange?logo=archive&color=yellow"></a>
77
<a href="https://pepy.tech/projects/onvif-python"><img alt="Pepy Total Downloads" src="https://img.shields.io/pepy/dt/onvif-python?label=Downloads&color=red"></a>
88
<br>
99
<a href="https://github.com/nirsimetri/onvif-python/actions/workflows/python-app.yml"><img alt="Build" src="https://github.com/nirsimetri/onvif-python/actions/workflows/python-app.yml/badge.svg?branch=main"></a>
@@ -79,6 +79,9 @@ from onvif import ONVIFDiscovery
7979
# Create discovery instance
8080
discovery = ONVIFDiscovery(timeout=5)
8181

82+
# or with a custom interface
83+
discovery = ONVIFDiscovery(timeout=5, interface="192.168.1.69")
84+
8285
# Discover devices
8386
devices = discovery.discover()
8487

@@ -314,12 +317,13 @@ This library includes a powerful command-line interface (CLI) for interacting wi
314317
<summary><b>1. Direct CLI</b></summary>
315318

316319
```bash
317-
usage: onvif [-h] [--host HOST] [--port PORT] [--username USERNAME] [--password PASSWORD] [--discover] [--filter FILTER] [--search SEARCH] [--page PAGE]
318-
[--per-page PER_PAGE] [--timeout TIMEOUT] [--https] [--no-verify] [--no-patch] [--interactive] [--debug] [--wsdl WSDL]
320+
usage: onvif [-h] [--host HOST] [--port PORT] [--username USERNAME] [--password PASSWORD] [--discover]
321+
[--filter FILTER] [--interface INTERFACE] [--search SEARCH] [--page PAGE] [--per-page PER_PAGE]
322+
[--timeout TIMEOUT] [--https] [--no-verify] [--no-patch] [--interactive] [--debug] [--wsdl WSDL]
319323
[--cache {all,db,mem,none}] [--health-check-interval HEALTH_CHECK_INTERVAL] [--output OUTPUT] [--version]
320324
[service] [method] [params ...]
321325

322-
ONVIF Terminal Client — v0.2.10
326+
ONVIF Terminal Client — v0.2.11
323327
https://github.com/nirsimetri/onvif-python
324328

325329
positional arguments:
@@ -338,6 +342,8 @@ options:
338342
--discover, -d Discover ONVIF devices on the network using WS-Discovery
339343
--filter FILTER, -f FILTER
340344
Filter discovered devices by types or scopes (case-insensitive substring match)
345+
--interface INTERFACE, -if INTERFACE
346+
Specify network interface IP for discovery (default: auto-detect)
341347
--search SEARCH, -s SEARCH
342348
Search ONVIF products database by model or company (e.g., 'c210', 'hikvision')
343349
--page PAGE Page number for search results (default: 1)
@@ -350,12 +356,13 @@ options:
350356
--debug Enable debug mode with XML capture
351357
--wsdl WSDL Custom WSDL directory path
352358
--cache {all,db,mem,none}
353-
Caching mode for ONVIFClient (default: all). 'all': memory+disk, 'db': disk-only, 'mem': memory-only, 'none': disabled.
359+
Caching mode for ONVIFClient (default: all). 'all': memory+disk, 'db': disk-only, 'mem':
360+
memory-only, 'none': disabled.
354361
--health-check-interval HEALTH_CHECK_INTERVAL, -hci HEALTH_CHECK_INTERVAL
355362
Health check interval in seconds for interactive mode (default: 10)
356363
--output OUTPUT, -o OUTPUT
357-
Save command output to file. Supports .json, .xml extensions for format detection, or plain text. XML format automatically enables
358-
debug mode for SOAP capture.
364+
Save command output to file. Supports .json, .xml extensions for format detection, or plain
365+
text. XML format automatically enables debug mode for SOAP capture.
359366
--version, -v Show ONVIF CLI version and exit
360367

361368
Examples:
@@ -400,14 +407,14 @@ Examples:
400407
<summary><b>2. Interactive Shell</b></summary>
401408

402409
```bash
403-
ONVIF Interactive Shell — v0.2.10
410+
ONVIF Interactive Shell — v0.2.11
404411
https://github.com/nirsimetri/onvif-python
405412

406413
Basic Commands:
407414
capabilities, caps - Show device capabilities
408415
services - Show available services with details
409416
info - Show connection and device information
410-
exit, quit - Exit the shell
417+
exit - Exit the shell
411418
shortcuts - Show available shortcuts
412419

413420
Navigation Commands:

‎README_ID.md‎

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<div align="center">
44
<a href="https://app.codacy.com/gh/nirsimetri/onvif-python/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade"><img src="https://app.codacy.com/project/badge/Grade/bff08a94e4d447b690cea49c6594826d"/></a>
55
<a href="https://deepwiki.com/nirsimetri/onvif-python"><img alt="Ask DeepWiki" src="https://deepwiki.com/badge.svg"></a>
6-
<a href="https://pypi.org/project/onvif-python/"><img alt="PyPI Version" src="https://img.shields.io/badge/PyPI-0.2.10-orange?logo=archive&color=yellow"></a>
6+
<a href="https://pypi.org/project/onvif-python/"><img alt="PyPI Version" src="https://img.shields.io/badge/PyPI-0.2.11-orange?logo=archive&color=yellow"></a>
77
<a href="https://pepy.tech/projects/onvif-python"><img alt="Pepy Total Downloads" src="https://img.shields.io/pepy/dt/onvif-python?label=Downloads&color=red"></a>
88
<br>
99
<a href="https://github.com/nirsimetri/onvif-python/actions/workflows/python-app.yml"><img alt="Build" src="https://github.com/nirsimetri/onvif-python/actions/workflows/python-app.yml/badge.svg?branch=main"></a>
@@ -79,6 +79,9 @@ from onvif import ONVIFDiscovery
7979
# Buat instance discovery
8080
discovery = ONVIFDiscovery(timeout=5)
8181

82+
# atau dengan interface yang berbeda
83+
discovery = ONVIFDiscovery(timeout=5, interface="192.168.1.69")
84+
8285
# Temukan perangkat
8386
devices = discovery.discover()
8487

@@ -314,12 +317,13 @@ Pustaka ini menyertakan antarmuka baris perintah (CLI) yang kuat untuk berintera
314317
<summary><b>1. CLI Langsung</b></summary>
315318

316319
```bash
317-
usage: onvif [-h] [--host HOST] [--port PORT] [--username USERNAME] [--password PASSWORD] [--discover] [--filter FILTER] [--search SEARCH] [--page PAGE]
318-
[--per-page PER_PAGE] [--timeout TIMEOUT] [--https] [--no-verify] [--no-patch] [--interactive] [--debug] [--wsdl WSDL]
320+
usage: onvif [-h] [--host HOST] [--port PORT] [--username USERNAME] [--password PASSWORD] [--discover]
321+
[--filter FILTER] [--interface INTERFACE] [--search SEARCH] [--page PAGE] [--per-page PER_PAGE]
322+
[--timeout TIMEOUT] [--https] [--no-verify] [--no-patch] [--interactive] [--debug] [--wsdl WSDL]
319323
[--cache {all,db,mem,none}] [--health-check-interval HEALTH_CHECK_INTERVAL] [--output OUTPUT] [--version]
320324
[service] [method] [params ...]
321325

322-
ONVIF Terminal Client — v0.2.10
326+
ONVIF Terminal Client — v0.2.11
323327
https://github.com/nirsimetri/onvif-python
324328

325329
positional arguments:
@@ -338,6 +342,8 @@ options:
338342
--discover, -d Discover ONVIF devices on the network using WS-Discovery
339343
--filter FILTER, -f FILTER
340344
Filter discovered devices by types or scopes (case-insensitive substring match)
345+
--interface INTERFACE, -if INTERFACE
346+
Specify network interface IP for discovery (default: auto-detect)
341347
--search SEARCH, -s SEARCH
342348
Search ONVIF products database by model or company (e.g., 'c210', 'hikvision')
343349
--page PAGE Page number for search results (default: 1)
@@ -350,12 +356,13 @@ options:
350356
--debug Enable debug mode with XML capture
351357
--wsdl WSDL Custom WSDL directory path
352358
--cache {all,db,mem,none}
353-
Caching mode for ONVIFClient (default: all). 'all': memory+disk, 'db': disk-only, 'mem': memory-only, 'none': disabled.
359+
Caching mode for ONVIFClient (default: all). 'all': memory+disk, 'db': disk-only, 'mem':
360+
memory-only, 'none': disabled.
354361
--health-check-interval HEALTH_CHECK_INTERVAL, -hci HEALTH_CHECK_INTERVAL
355362
Health check interval in seconds for interactive mode (default: 10)
356363
--output OUTPUT, -o OUTPUT
357-
Save command output to file. Supports .json, .xml extensions for format detection, or plain text. XML format automatically enables
358-
debug mode for SOAP capture.
364+
Save command output to file. Supports .json, .xml extensions for format detection, or plain
365+
text. XML format automatically enables debug mode for SOAP capture.
359366
--version, -v Show ONVIF CLI version and exit
360367

361368
Examples:
@@ -401,14 +408,14 @@ Examples:
401408

402409

403410
```bash
404-
ONVIF Interactive Shell — v0.2.10
411+
ONVIF Interactive Shell — v0.2.11
405412
https://github.com/nirsimetri/onvif-python
406413

407414
Basic Commands:
408415
capabilities, caps - Show device capabilities
409416
services - Show available services with details
410417
info - Show connection and device information
411-
exit, quit - Exit the shell
418+
exit - Exit the shell
412419
shortcuts - Show available shortcuts
413420

414421
Navigation Commands:

‎examples/check_all_capabilities.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
capabilities using the Core (Device Management) service.
99
"""
1010

11-
from onvif import ONVIFClient, CacheMode
11+
from onvif import CacheMode, ONVIFClient
1212

1313
HOST = "192.168.1.3"
1414
PORT = 80

‎examples/check_device.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"""
1111

1212
import json
13+
1314
from onvif import ONVIFClient
1415

1516
HOST = "192.168.1.3"

‎examples/check_ptz.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"""
99

1010
from time import sleep
11+
1112
from onvif import ONVIFClient
1213

1314
HOST = "192.168.1.3"

‎examples/device_discovery.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"""
1111

1212
import json
13+
1314
from onvif import ONVIFDiscovery
1415

1516
try:

‎examples/device_discovery_raw.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
"""
1919

2020
import socket
21-
import uuid
22-
from lxml import etree
23-
import sys
2421
import struct
22+
import sys
23+
import uuid
2524

25+
from lxml import etree
2626

2727
# WS-Discovery constants
2828
WS_DISCOVERY_TIMEOUT = 4 # 4 seconds - time to wait to receive packets

0 commit comments

Comments
 (0)