Skip to content

Commit 259e51e

Browse files
authored
Release 0.3.0
2 parents e259ab7 + 0461135 commit 259e51e

86 files changed

Lines changed: 5193 additions & 957 deletions

Some content is hidden

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

.flake8

Lines changed: 0 additions & 6 deletions
This file was deleted.

.github/workflows/python-app.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,16 @@ jobs:
3434
- name: Install dependencies
3535
run: |
3636
python -m pip install --upgrade pip
37-
pip install flake8 pytest
37+
pip install pylint pytest
3838
- name: Install project
3939
run: pip install .
40-
- name: Lint with flake8
40+
- name: Lint with pylint
4141
run: |
42-
# stop the build if there are Python syntax errors or undefined names
43-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
44-
# run full lint using .flake8 config, but don’t fail the build
45-
flake8 . --count --exit-zero --statistics
42+
# Fail CI on fatal errors and errors
43+
pylint onvif --errors-only --score=n
44+
45+
# Report all other lint issues without failing CI
46+
pylint onvif --exit-zero
4647
- name: Test with pytest
4748
run: |
4849
pytest

.pylintrc

Lines changed: 0 additions & 3 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ 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, mypy, isort, pylint)
64+
# Install development dependencies (pytest, black, docformatter, mypy, isort, pylint)
6565
pip install -e ".[dev]"
6666
```
6767
Or use `pyproject.toml` with your preferred tool (e.g., Poetry, pip).
@@ -73,14 +73,20 @@ All contributors are expected to follow our [Code of Conduct](./CODE_OF_CONDUCT.
7373

7474
4. **Lint and format code:**
7575
```bash
76-
# Check code style with flake8
77-
flake8 .
78-
7976
# Check code linting with pylint
8077
pylint .
8178

79+
# Check error with pylint
80+
pylint onvif --errors-only --score=n
81+
82+
# Static type checking
83+
mypy onvif
84+
8285
# Sort import order
8386
isort .
87+
88+
# Format docstring with docformatter
89+
docformatter --recursive --black --in-place .
8490

8591
# Format code with black
8692
black .
@@ -132,8 +138,8 @@ Use the following commit/PR title types:
132138

133139
## Style Guide
134140

135-
- **PEP8** is the standard for Python code style. Use tools like `flake8` and `black` to check and format your code.
136-
- **Docstrings:** Use clear, concise docstrings for modules, classes, and functions.
141+
- **PEP8** is the standard for Python code style. Use tools like `pylint` and `black` to check and format your code.
142+
- **Docstrings:** Use clear, concise docstrings for modules, classes, and functions. Use `docformatter` to format your docstring.
137143
- **Type hints:** Add type annotations where appropriate for better readability and tooling support.
138144
- **Comments:** Write helpful comments, especially for complex logic.
139145
- **Naming:** Use descriptive variable, function, and class names.

README.md

Lines changed: 21 additions & 21 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.11-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.3.0-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>
@@ -317,13 +317,12 @@ This library includes a powerful command-line interface (CLI) for interacting wi
317317
<summary><b>1. Direct CLI</b></summary>
318318

319319
```bash
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]
323-
[--cache {all,db,mem,none}] [--health-check-interval HEALTH_CHECK_INTERVAL] [--output OUTPUT] [--version]
320+
usage: onvif [-h] [--host HOST] [--port PORT] [--username USERNAME] [--password PASSWORD] [--discover] [--filter FILTER] [--interface INTERFACE] [--discovery-timeout DISCOVERY_TIMEOUT] [--search SEARCH]
321+
[--page PAGE] [--per-page PER_PAGE] [--timeout TIMEOUT] [--https] [--no-verify] [--no-patch] [--interactive] [--debug] [--wsdl WSDL] [--cache {all,db,mem,none}]
322+
[--health-check-interval HEALTH_CHECK_INTERVAL] [--output OUTPUT] [--version]
324323
[service] [method] [params ...]
325324

326-
ONVIF Terminal Client — v0.2.11
325+
ONVIF Terminal Client — v0.3.0
327326
https://github.com/nirsimetri/onvif-python
328327

329328
positional arguments:
@@ -344,25 +343,25 @@ options:
344343
Filter discovered devices by types or scopes (case-insensitive substring match)
345344
--interface INTERFACE, -if INTERFACE
346345
Specify network interface IP for discovery (default: auto-detect)
346+
--discovery-timeout DISCOVERY_TIMEOUT, -dt DISCOVERY_TIMEOUT
347+
Discovery timeout in seconds (default: 4)
347348
--search SEARCH, -s SEARCH
348349
Search ONVIF products database by model or company (e.g., 'c210', 'hikvision')
349350
--page PAGE Page number for search results (default: 1)
350351
--per-page PER_PAGE Number of results per page (default: 20)
351-
--timeout TIMEOUT Connection timeout in seconds (default: 10)
352+
--timeout TIMEOUT ONVIF connection timeout in seconds (default: 10)
352353
--https Use HTTPS instead of HTTP
353354
--no-verify Disable SSL certificate verification
354355
--no-patch Disable ZeepPatcher
355356
--interactive, -i Start interactive mode
356357
--debug Enable debug mode with XML capture
357358
--wsdl WSDL Custom WSDL directory path
358359
--cache {all,db,mem,none}
359-
Caching mode for ONVIFClient (default: all). 'all': memory+disk, 'db': disk-only, 'mem':
360-
memory-only, 'none': disabled.
360+
Caching mode for ONVIFClient (default: all). 'all': memory+disk, 'db': disk-only, 'mem': memory-only, 'none': disabled.
361361
--health-check-interval HEALTH_CHECK_INTERVAL, -hci HEALTH_CHECK_INTERVAL
362362
Health check interval in seconds for interactive mode (default: 10)
363363
--output OUTPUT, -o OUTPUT
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.
364+
Save command output to file. Supports .json, .xml extensions for format detection, or plain text. XML format automatically enables debug mode for SOAP capture.
366365
--version, -v Show ONVIF CLI version and exit
367366

368367
Examples:
@@ -407,7 +406,7 @@ Examples:
407406
<summary><b>2. Interactive Shell</b></summary>
408407

409408
```bash
410-
ONVIF Interactive Shell — v0.2.11
409+
ONVIF Interactive Shell — v0.3.0
411410
https://github.com/nirsimetri/onvif-python
412411

413412
Basic Commands:
@@ -502,7 +501,7 @@ If you omit the username or password, you will be prompted to enter them securel
502501
| `desc <method>` | Show documentation for a method |
503502
| `store <name>` | Store the last result with a variable name |
504503
| `show <name>` | Display a stored variable |
505-
| `exit` / `quit` | Exit the shell |
504+
| `exit` | Exit the shell |
506505

507506
> [!IMPORTANT]
508507
> You can see all the other commands available in the interactive shell by trying it out directly. The interactive shell runs periodic background health checks to detect connection loss. It uses silent TCP pings to avoid interrupting your work and will automatically exit if the device is unreachable, similar to an SSH session.
@@ -697,8 +696,9 @@ The `ONVIFClient` class provides various configuration options to customize the
697696
|-----------|------|----------|---------|-------------|
698697
| `host` | `str` | ✅ Yes | - | IP address or hostname of the ONVIF device (e.g., `"192.168.1.17"`) |
699698
| `port` | `int` | ✅ Yes | - | Port number for ONVIF service (common ports: `80`, `8000`, `8080`) |
700-
| `username` | `str` | ✅ Yes | - | Username for device authentication (use digest authentication) |
701-
| `password` | `str` | ✅ Yes | - | Password for device authentication |
699+
| `username` | `str` | ❌ No | - | Username for device authentication |
700+
| `password` | `str` | ❌ No | - | Password for device authentication |
701+
| `http_digest` | `str` | ❌ No | `False` | `True` = use HTTP Digest / `False` = use WS-Usernametoken |
702702

703703
</details>
704704

@@ -709,7 +709,7 @@ The `ONVIFClient` class provides various configuration options to customize the
709709
|-----------|------|----------|---------|-------------|
710710
| `timeout` | `int` | ❌ No | `10` | Connection timeout in seconds for SOAP requests |
711711
| `use_https` | `bool` | ❌ No | `False` | Use HTTPS instead of HTTP for secure communication |
712-
| `verify_ssl` | `bool` | ❌ No | `True` | Verify SSL certificates when using HTTPS (set to `False` for self-signed certificates) |
712+
| `verify_ssl` | `bool` | ❌ No | `False` | Verify SSL certificates when using HTTPS (set to `False` for self-signed certificates) |
713713

714714
</details>
715715

@@ -1099,11 +1099,11 @@ Some ONVIF services have multiple bindings in the same WSDL. These typically inc
10991099
```python
11001100
client.security() # root binding
11011101
client.jwt() # sub-binding accessor
1102-
client.authorizationserver(xaddr) # sub-binding accessor (requires xAddr)
1103-
client.keystore(xaddr) # ..
1104-
client.dot1x(xaddr)
1105-
client.tlsserver(xaddr)
1106-
client.mediasigning(xaddr)
1102+
client.authorizationserver() # ..
1103+
client.keystore()
1104+
client.dot1x()
1105+
client.tlsserver()
1106+
client.mediasigning()
11071107
```
11081108

11091109
3. **Analytics**

README_ID.md

Lines changed: 21 additions & 21 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.11-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.3.0-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>
@@ -317,13 +317,12 @@ Pustaka ini menyertakan antarmuka baris perintah (CLI) yang kuat untuk berintera
317317
<summary><b>1. CLI Langsung</b></summary>
318318

319319
```bash
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]
323-
[--cache {all,db,mem,none}] [--health-check-interval HEALTH_CHECK_INTERVAL] [--output OUTPUT] [--version]
320+
usage: onvif [-h] [--host HOST] [--port PORT] [--username USERNAME] [--password PASSWORD] [--discover] [--filter FILTER] [--interface INTERFACE] [--discovery-timeout DISCOVERY_TIMEOUT] [--search SEARCH]
321+
[--page PAGE] [--per-page PER_PAGE] [--timeout TIMEOUT] [--https] [--no-verify] [--no-patch] [--interactive] [--debug] [--wsdl WSDL] [--cache {all,db,mem,none}]
322+
[--health-check-interval HEALTH_CHECK_INTERVAL] [--output OUTPUT] [--version]
324323
[service] [method] [params ...]
325324

326-
ONVIF Terminal Client — v0.2.11
325+
ONVIF Terminal Client — v0.3.0
327326
https://github.com/nirsimetri/onvif-python
328327

329328
positional arguments:
@@ -344,25 +343,25 @@ options:
344343
Filter discovered devices by types or scopes (case-insensitive substring match)
345344
--interface INTERFACE, -if INTERFACE
346345
Specify network interface IP for discovery (default: auto-detect)
346+
--discovery-timeout DISCOVERY_TIMEOUT, -dt DISCOVERY_TIMEOUT
347+
Discovery timeout in seconds (default: 4)
347348
--search SEARCH, -s SEARCH
348349
Search ONVIF products database by model or company (e.g., 'c210', 'hikvision')
349350
--page PAGE Page number for search results (default: 1)
350351
--per-page PER_PAGE Number of results per page (default: 20)
351-
--timeout TIMEOUT Connection timeout in seconds (default: 10)
352+
--timeout TIMEOUT ONVIF connection timeout in seconds (default: 10)
352353
--https Use HTTPS instead of HTTP
353354
--no-verify Disable SSL certificate verification
354355
--no-patch Disable ZeepPatcher
355356
--interactive, -i Start interactive mode
356357
--debug Enable debug mode with XML capture
357358
--wsdl WSDL Custom WSDL directory path
358359
--cache {all,db,mem,none}
359-
Caching mode for ONVIFClient (default: all). 'all': memory+disk, 'db': disk-only, 'mem':
360-
memory-only, 'none': disabled.
360+
Caching mode for ONVIFClient (default: all). 'all': memory+disk, 'db': disk-only, 'mem': memory-only, 'none': disabled.
361361
--health-check-interval HEALTH_CHECK_INTERVAL, -hci HEALTH_CHECK_INTERVAL
362362
Health check interval in seconds for interactive mode (default: 10)
363363
--output OUTPUT, -o OUTPUT
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.
364+
Save command output to file. Supports .json, .xml extensions for format detection, or plain text. XML format automatically enables debug mode for SOAP capture.
366365
--version, -v Show ONVIF CLI version and exit
367366

368367
Examples:
@@ -408,7 +407,7 @@ Examples:
408407

409408

410409
```bash
411-
ONVIF Interactive Shell — v0.2.11
410+
ONVIF Interactive Shell — v0.3.0
412411
https://github.com/nirsimetri/onvif-python
413412

414413
Basic Commands:
@@ -503,7 +502,7 @@ Jika Anda tidak menyertakan nama pengguna atau kata sandi, Anda akan diminta unt
503502
| `desc <method>` | Tampilkan dokumentasi untuk sebuah metode |
504503
| `store <name>` | Simpan hasil terakhir dengan nama variabel |
505504
| `show <name>` | Tampilkan variabel yang disimpan |
506-
| `exit` / `quit` | Keluar dari shell |
505+
| `exit` | Keluar dari shell |
507506

508507
> [!IMPORTANT]
509508
> Anda dapat melihat semua perintah lainnya yang tersedia di shell interaktif dengan mencobanya langsung. Shell interaktif menjalankan pemeriksaan kesehatan latar belakang secara berkala untuk mendeteksi kehilangan koneksi. Shell ini menggunakan ping TCP diam-diam agar tidak mengganggu pekerjaan Anda dan akan otomatis keluar jika perangkat tidak dapat dijangkau, mirip dengan sesi SSH.
@@ -697,8 +696,9 @@ Kelas `ONVIFClient` menyediakan berbagai opsi konfigurasi untuk menyesuaikan per
697696
|-----------|------|-------|---------|-----------|
698697
| `host` | `str` | ✅ Ya | - | Alamat IP atau hostname perangkat ONVIF (mis., `"192.168.1.17"`) |
699698
| `port` | `int` | ✅ Ya | - | Nomor port untuk layanan ONVIF (port umum: `80`, `8000`, `8080`) |
700-
| `username` | `str` | ✅ Ya | - | Nama pengguna untuk autentikasi perangkat (menggunakan digest authentication) |
701-
| `password` | `str` | ✅ Ya | - | Kata sandi untuk autentikasi perangkat |
699+
| `username` | `str` | ❌ Tidak | - | Nama pengguna untuk autentikasi perangkat |
700+
| `password` | `str` | ❌ Tidak | - | Kata sandi untuk autentikasi perangkat |
701+
| `http_digest` | `str` | ❌ Tidak | `False` | `True` = pakai HTTP Digest / `False` = pakai WS-Usernametoken |
702702

703703
</details>
704704

@@ -709,7 +709,7 @@ Kelas `ONVIFClient` menyediakan berbagai opsi konfigurasi untuk menyesuaikan per
709709
|-----------|------|-------|---------|-----------|
710710
| `timeout` | `int` | ❌ Tidak | `10` | Timeout koneksi dalam detik untuk permintaan SOAP |
711711
| `use_https` | `bool` | ❌ Tidak | `False` | Gunakan HTTPS sebagai pengganti HTTP untuk komunikasi aman |
712-
| `verify_ssl` | `bool` | ❌ Tidak | `True` | Verifikasi sertifikat SSL saat menggunakan HTTPS (set ke `False` untuk sertifikat self-signed) |
712+
| `verify_ssl` | `bool` | ❌ Tidak | `False` | Verifikasi sertifikat SSL saat menggunakan HTTPS (set ke `False` untuk sertifikat self-signed) |
713713

714714
</details>
715715

@@ -1099,11 +1099,11 @@ Beberapa layanan ONVIF memiliki banyak binding dalam WSDL yang sama. Biasanya me
10991099
```python
11001100
client.security() # root binding
11011101
client.jwt() # sub-binding accessor
1102-
client.authorizationserver(xaddr) # sub-binding accessor (requires xAddr)
1103-
client.keystore(xaddr) # ..
1104-
client.dot1x(xaddr)
1105-
client.tlsserver(xaddr)
1106-
client.mediasigning(xaddr)
1102+
client.authorizationserver() # ..
1103+
client.keystore()
1104+
client.dot1x()
1105+
client.tlsserver()
1106+
client.mediasigning()
11071107
```
11081108

11091109
3. **Analytics (Analitik)**

examples/add_media_profile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
)
113113
print(f"Stream URI: {stream_uri.Uri}")
114114

115-
except Exception as e:
115+
except Exception as e: # pylint: disable=broad-exception-caught
116116
print(f"Error: {e}")
117117
import traceback
118118

examples/add_onvif_user.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@
2424

2525
# print current users to verify addition
2626
print(device.GetUsers())
27-
except Exception as e:
27+
except Exception as e: # pylint: disable=broad-exception-caught
2828
print(e)

examples/check_all_capabilities.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@
1919
client = ONVIFClient(HOST, PORT, USERNAME, PASSWORD, cache=CacheMode.NONE)
2020
capabilities = client.devicemgmt().GetCapabilities(Category="All")
2121
print(capabilities)
22-
except Exception as e:
22+
except Exception as e: # pylint: disable=broad-exception-caught
2323
print(e)

examples/check_all_services.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@
1919
client = ONVIFClient(HOST, PORT, USERNAME, PASSWORD)
2020
services = client.devicemgmt().GetServices(IncludeCapability=True)
2121
print(services)
22-
except Exception as e:
22+
except Exception as e: # pylint: disable=broad-exception-caught
2323
print(e)

0 commit comments

Comments
 (0)