onvif-python 0.4.1__py3-none-any.whl → 0.4.2__py3-none-any.whl

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.
@@ -63,7 +63,7 @@ def select_device_interactive(devices: list) -> tuple[str, int, bool] | None:
63
63
  else colorize("HTTP", "white")
64
64
  )
65
65
  print(
66
- f"\n{colorize(f"[{idx}]", "yellow")} {colorize(host_port, 'yellow')} ({protocol_indicator})"
66
+ f"\n{colorize(f'[{idx}]', 'yellow')} {colorize(host_port, 'yellow')} ({protocol_indicator})"
67
67
  )
68
68
 
69
69
  # Remove uuid: or urn:uuid: prefix from EPR
@@ -70,7 +70,7 @@ def print_interactive_intro(args, device_info_text) -> str:
70
70
  f"{repo_info}\n"
71
71
  f"{terminal_header}\n"
72
72
  f" Connected to : {colorize(f'{args.host}:{args.port}', 'yellow')}\n"
73
- f" Auth Method : {colorize(f'{'HTTP Digest' if args.digest else 'WS-UsernameToken'}', 'yellow')}"
73
+ f" Auth Method : {colorize('HTTP Digest' if args.digest else 'WS-UsernameToken', 'yellow')}"
74
74
  f"{options_display}{device_info_text}\n\n"
75
75
  f"{colorize('[Quick Start]', 'green')}\n"
76
76
  f" - Type {colorize('dev', 'yellow')} + {colorize('TAB', 'yellow')} to see `devicemgmt` suggestion\n"
@@ -81,7 +81,7 @@ def search_products(search_term: str, page: int = 1, per_page: int = 20) -> None
81
81
  )
82
82
  print(
83
83
  f"Showing {colorize(f'{offset + 1}-{min(offset + per_page, total_count)}', 'cyan')} "
84
- f"of {colorize(f"{total_count} results", 'cyan')}"
84
+ f"of {colorize(f'{total_count} results', 'cyan')}"
85
85
  )
86
86
  print()
87
87
 
onvif/cli/interactive.py CHANGED
@@ -90,7 +90,7 @@ class InteractiveShell(cmd.Cmd):
90
90
  import readline
91
91
 
92
92
  # Set completer to this instance
93
- readline.set_completer(self.complete) # type: ignore[attr-defined]
93
+ readline.set_completer(self.complete) # type: ignore[attr-defined, arg-type]
94
94
  readline.set_completer_delims(" \t\n`!@#$%^&*()=+[{]}\\|;:'\",<>?") # type: ignore[attr-defined]
95
95
 
96
96
  # Enable tab completion, making it compatible with both GNU readline and libedit
@@ -124,30 +124,34 @@ class InteractiveShell(cmd.Cmd):
124
124
  serial = getattr(self.device_data, "SerialNumber", "Unknown")
125
125
  hardware_id = getattr(self.device_data, "HardwareId", "Unknown")
126
126
 
127
- # Get ONVIF version
128
- services = self.client.devicemgmt().GetServices(IncludeCapability=False)
129
- devicemgmt_service = next(
130
- (
131
- s
132
- for s in services
133
- if hasattr(s, "Namespace")
134
- and s.Namespace == "http://www.onvif.org/ver10/device/wsdl"
135
- ),
136
- None,
137
- )
138
- if devicemgmt_service and hasattr(devicemgmt_service, "Version"):
139
- version = devicemgmt_service.Version
140
- major = getattr(version, "Major", "")
141
- minor = getattr(version, "Minor", "")
142
- if major and minor:
143
- onvif_version = f"{major}.{minor}"
144
- elif major:
145
- onvif_version = str(major)
146
- except ONVIFOperationException as e:
147
- if isinstance(e.original_exception, (RequestException, TransportError)):
148
- self._handle_connection_error()
127
+ # Get latest supported ONVIF version
128
+ supported_versions = self.client.devicemgmt().GetCapabilities(
129
+ Category="All"
130
+ )["Device"]["System"]["SupportedVersions"]
131
+ if supported_versions:
132
+ latest_version = max(
133
+ supported_versions,
134
+ key=lambda version: (
135
+ getattr(version, "Major", 0),
136
+ getattr(version, "Minor", 0),
137
+ ),
138
+ )
139
+
140
+ major = getattr(latest_version, "Major", "")
141
+ minor = getattr(latest_version, "Minor", "")
142
+
143
+ if major != "":
144
+ onvif_version = (
145
+ f"{major}.{minor} {colorize('[Latest]', 'green')}"
146
+ if minor != ""
147
+ else str(major)
148
+ )
149
+ except (ONVIFOperationException, KeyError, AttributeError) as e:
150
+ if isinstance(e, ONVIFOperationException):
151
+ if isinstance(e.original_exception, (RequestException, TransportError)):
152
+ self._handle_connection_error()
149
153
  else:
150
- # For other errors (e.g., GetServices not supported), we can still proceed
154
+ # For other errors (e.g., GetCapabilities not supported), we can still proceed
151
155
  # with basic device info if GetDeviceInformation succeeded.
152
156
  pass
153
157
 
@@ -1164,8 +1168,10 @@ class InteractiveShell(cmd.Cmd):
1164
1168
 
1165
1169
  def do_clear(self, _line):
1166
1170
  """Clear terminal screen."""
1167
- # Clear screen for both Windows and Unix-like systems
1168
- os.system("cls" if os.name == "nt" else "clear")
1171
+ if sys.platform == "win32":
1172
+ print("\033[2J\033[3J\033[H", end="")
1173
+ else:
1174
+ print("\033[2J\033[H", end="")
1169
1175
 
1170
1176
  def do_cls(self, _line):
1171
1177
  """Clear stored data."""
@@ -1221,7 +1227,7 @@ class InteractiveShell(cmd.Cmd):
1221
1227
  f"\n Connected to : "
1222
1228
  f"{colorize(f'{self.args.host}:{self.args.port}', 'yellow')}"
1223
1229
  f"\n Auth Method : "
1224
- f"{colorize(f'{'HTTP Digest' if self.args.digest else 'WS-UsernameToken'}', 'yellow')}"
1230
+ f"{colorize('HTTP Digest' if self.args.digest else 'WS-UsernameToken', 'yellow')}"
1225
1231
  f"{options_display}{self.device_info_text}"
1226
1232
  )
1227
1233
  print() # Extra newline for spacing
onvif/cli/utils.py CHANGED
@@ -230,7 +230,7 @@ def _colors_enabled() -> bool:
230
230
 
231
231
  try:
232
232
  # Enable ANSI escape sequences
233
- kernel32 = ctypes.windll.kernel32
233
+ kernel32 = ctypes.windll.kernel32 # type: ignore[attr-defined]
234
234
  h_stdout = kernel32.GetStdHandle(-11)
235
235
 
236
236
  # Get current console mode
onvif/meta.py CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  from typing import Final
4
4
 
5
- __version__: Final[str] = "0.4.1"
5
+ __version__: Final[str] = "0.4.2"
6
6
  __repository__: Final[str] = "https://github.com/nirsimetri/onvif-python"
onvif/utils/wsdl.py CHANGED
@@ -717,7 +717,10 @@ class ONVIFWSDL:
717
717
  def get_wsdl_map(cls) -> dict[str, dict[str, Any]]:
718
718
  """Get the complete WSDL map for all services."""
719
719
  cls._ensure_wsdl_map_initialized()
720
- assert cls.WSDL_MAP is not None
720
+
721
+ if cls.WSDL_MAP is None:
722
+ raise RuntimeError("WSDL map was not initialized")
723
+
721
724
  return cls.WSDL_MAP
722
725
 
723
726
  @classmethod
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: onvif-python
3
- Version: 0.4.1
3
+ Version: 0.4.2
4
4
  Summary: A modern Python library for ONVIF-compliant devices
5
5
  Author-email: Nirsimetri Technologies® <open@nirsimetri.com>
6
6
  Maintainer: Kaburagi
@@ -42,6 +42,9 @@ Requires-Dist: mypy; extra == "dev"
42
42
  Requires-Dist: isort; extra == "dev"
43
43
  Requires-Dist: pylint; extra == "dev"
44
44
  Requires-Dist: docformatter; extra == "dev"
45
+ Requires-Dist: lxml-stubs; extra == "dev"
46
+ Requires-Dist: types-setuptools; extra == "dev"
47
+ Requires-Dist: types-requests; extra == "dev"
45
48
  Provides-Extra: docs
46
49
  Requires-Dist: mkdocs-material; extra == "docs"
47
50
  Requires-Dist: mkdocstrings[python]; extra == "docs"
@@ -52,7 +55,7 @@ Dynamic: license-file
52
55
 
53
56
  <div align="center">
54
57
  <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://img.shields.io/codacy/grade/bff08a94e4d447b690cea49c6594826d?style=plastic&logo=codacy&label=Code%20Quality"/></a>
55
- <a href="https://pypi.org/project/onvif-python/"><img alt="PyPI Version" src="https://img.shields.io/badge/Version-0.4.1-orange?logo=python&logoColor=white&color=yellow&style=plastic"></a>
58
+ <a href="https://pypi.org/project/onvif-python/"><img alt="PyPI Version" src="https://img.shields.io/badge/Version-0.4.2-orange?logo=python&logoColor=white&color=yellow&style=plastic"></a>
56
59
  <a href="https://pepy.tech/projects/onvif-python"><img alt="Pepy Total Downloads" src="https://img.shields.io/pepy/dt/onvif-python?logo=pypi&logoColor=white&label=Downloads&color=red&style=plastic"></a>
57
60
  <br>
58
61
  <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>
@@ -1,18 +1,18 @@
1
1
  onvif/__init__.py,sha256=48s-ZSvUgrVdXW7SiMGooXAH3y-4lypSb_EVzDdtUIA,577
2
2
  onvif/client.py,sha256=mAokhWVNujje7FytlOdGPFRqd5k8Y_yF8W6E-jV-7xE,34200
3
- onvif/meta.py,sha256=GrhGTn_R0zSzgLvALnoF-AdobKS1j0okiCn5SLtdOpc,218
3
+ onvif/meta.py,sha256=fhSoQ2Flwc4K6HsO-AFcBTanX2yCfJg5o8MQgV-9WLI,218
4
4
  onvif/operator.py,sha256=LhxJ86bW_yuXdWFCYQggIbFpdNnBL6R2Upa-AcH1Lb0,17173
5
5
  onvif/cli/__init__.py,sha256=VVDBEJxI9VzfiHdbWYzDwS7TTsggInr4fVWgRJ5QOuE,70
6
6
  onvif/cli/__main__.py,sha256=QnY-Aty8PlzAgVmom8HEqA9fbVu6wY4kF-WNXYNPvAg,148
7
- onvif/cli/interactive.py,sha256=2O7gX8PhPBaZ-n8BWPBJF2PbtjIvYUEvgTpaOwobA78,53059
7
+ onvif/cli/interactive.py,sha256=_aVR3Udou4mVEbddzH25FFJa5II7RU10mvlYT7EZln8,53246
8
8
  onvif/cli/main.py,sha256=im9omOhRS_FPcpw4TRGhacRe5wpKnIEkqvB3wEbUc7U,11133
9
- onvif/cli/utils.py,sha256=CFXF90AOhRMyn-eosJj0Icc3SHre7YEVb1ILQ9mGufI,21061
9
+ onvif/cli/utils.py,sha256=De-6TbcijrRWXJNwEtdrtmK764KAK28-tGHO9Hgp_ec,21091
10
10
  onvif/cli/helpers/__init__.py,sha256=Pr9LsULlezfUM3bGlP7t6zKYR5Qqy-F5oNXDcjnB0rY,640
11
- onvif/cli/helpers/discovery.py,sha256=z1WZk9l7JZKR800rQLS2PpRbZUJWoBmuEXNU42ryDRg,6062
11
+ onvif/cli/helpers/discovery.py,sha256=XMP6NQpqZxcbtSAqO1q_YPetY0sTsBjOk6LutpQFXE0,6062
12
12
  onvif/cli/helpers/execution.py,sha256=abcFpc2Ui7HGBfaL4AuusWfVLcGWbuo9cfwZMIH7bOw,1692
13
13
  onvif/cli/helpers/files.py,sha256=Bgzqln4xGPBp_yR7AoclJO6rABoLB7eG9xY2RzDOWLk,7383
14
- onvif/cli/helpers/messages.py,sha256=z5Xt_hp-xWa4cSPxY95H5XdD-FK2EV5znfXf60KEyWw,9743
15
- onvif/cli/helpers/products.py,sha256=QIpdYXLocArEr3QWtDto5HwS48-X7ycNcBT81qb4B5Q,11124
14
+ onvif/cli/helpers/messages.py,sha256=304NtPojpHGsglecB39S2HqfMjp3qpuK0k1PQxjA99s,9738
15
+ onvif/cli/helpers/products.py,sha256=vqork9Fjqba0jkHMaTEd4TCjDTclC-dj_FRLY57T4JE,11124
16
16
  onvif/cli/helpers/wsdl_parser.py,sha256=0BqA0_lNFt_ZkDdSNgBqBvfu4S5HbG6BV9We1us8s34,36222
17
17
  onvif/db/companies.db,sha256=yJ8bSHfGpxNnA5NRBhYOFS_1Pix-KgH8GnUFV3ytzPo,270336
18
18
  onvif/db/products.db,sha256=4BVPfy6i6pLMLQyfue238uRp6_NIDodu4QXd9iCoooY,81559552
@@ -63,7 +63,7 @@ onvif/utils/error_handlers.py,sha256=X2Sbt7NQM310IvjpnrMU2f87THaAShHN_n-KYUqeMas
63
63
  onvif/utils/exceptions.py,sha256=NvV0YS8s_Unak9l0x2Sls4YMSGAG5AoXj1VGtntz24I,8258
64
64
  onvif/utils/plugins.py,sha256=U08es6mfzLE1SLA5WCy-KoKD5g-TUKw9yEKaU7JXO7U,18571
65
65
  onvif/utils/service.py,sha256=aEFkMWOfmUErfzJS7M8q3k9BpiW2Sa4orXoMipmwiZk,15019
66
- onvif/utils/wsdl.py,sha256=JrvW_IJZt-DbKZ3P-Reqwj_8dz9uhoIfWcGEaXe15ZQ,29646
66
+ onvif/utils/wsdl.py,sha256=fDjbhCDByFUFWR3hcB077wfCPvMgWZaJ0GeNftOoECA,29704
67
67
  onvif/utils/zeep.py,sha256=LU1esNhEqbxo73yjIOt5fERuwnP2Pmfy-YKxjBmt908,28734
68
68
  onvif/wsdl/LICENSE.md,sha256=O0J5vlcNSuEulS5rESOZWYy-IEnH4QeJkQ4ebZZNkSQ,16439
69
69
  onvif/wsdl/schema/common/b-2.xsd,sha256=KRP2rKG4dhHQ0pe1v7O_wuzlYki6cD-x4TWvtAqk6Ww,22705
@@ -136,9 +136,9 @@ onvif/wsdl/ver20/util/federated_search_documentation.html,sha256=GR6a4SPBsRDisaW
136
136
  onvif/wsdl/ver20/util/fedsearch-docu-viewer.xsl,sha256=8eP-uMZgsTtuU5WaVyCzs_DJZqWIFD7iRz_5-3ComPg,325
137
137
  onvif/wsdl/ver20/util/onvif-wsdl-viewer.xsl,sha256=Emauxs6rh69IxlxlU3k_LEH_i3SsRbwIKUk-VcMlVgk,94525
138
138
  onvif/wsdl/ver20/util/operationIndex.html,sha256=mUsAGgNUFCIQjVV9Rx_O5YUNW3EdWNhUkAbBY-xVMhQ,39290
139
- onvif_python-0.4.1.dist-info/licenses/LICENSE.md,sha256=5FDlvvnRA-PzNEK40VBwMQ9Kjzwe8tdMCA9bhEmx04k,1096
140
- onvif_python-0.4.1.dist-info/METADATA,sha256=ZTEOA-SdegwEFe0JhRjYyYum-9yAckqornlGwPlcyIU,6033
141
- onvif_python-0.4.1.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
142
- onvif_python-0.4.1.dist-info/entry_points.txt,sha256=7xUdI64yzWh7YfNPQDKCW9cT8XIgWuNCloikP9-yjqY,46
143
- onvif_python-0.4.1.dist-info/top_level.txt,sha256=MqCi1uJmIvtVFJDz2IxLbpwq6FwDtWhqrWQtKwLaQg4,6
144
- onvif_python-0.4.1.dist-info/RECORD,,
139
+ onvif_python-0.4.2.dist-info/licenses/LICENSE.md,sha256=5FDlvvnRA-PzNEK40VBwMQ9Kjzwe8tdMCA9bhEmx04k,1096
140
+ onvif_python-0.4.2.dist-info/METADATA,sha256=LgmtyeLC8XZtTkomALoq4G_PCo8t3jt919neRwdGFjU,6169
141
+ onvif_python-0.4.2.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
142
+ onvif_python-0.4.2.dist-info/entry_points.txt,sha256=7xUdI64yzWh7YfNPQDKCW9cT8XIgWuNCloikP9-yjqY,46
143
+ onvif_python-0.4.2.dist-info/top_level.txt,sha256=MqCi1uJmIvtVFJDz2IxLbpwq6FwDtWhqrWQtKwLaQg4,6
144
+ onvif_python-0.4.2.dist-info/RECORD,,