uiprotect 7.18.0__py3-none-any.whl → 7.19.0__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.

Potentially problematic release.


This version of uiprotect might be problematic. Click here for more details.

uiprotect/api.py CHANGED
@@ -65,6 +65,7 @@ from .utils import (
65
65
  decode_token_cookie,
66
66
  get_response_reason,
67
67
  ip_from_host,
68
+ pybool_to_json_bool,
68
69
  set_debug,
69
70
  to_js_time,
70
71
  utc_now,
@@ -1529,7 +1530,7 @@ class ProtectApiClient(BaseApiClient):
1529
1530
  public_api=True,
1530
1531
  raise_exception=False,
1531
1532
  url=f"/v1/cameras/{camera_id}/snapshot",
1532
- params={"highQuality": high_quality},
1533
+ params={"highQuality": pybool_to_json_bool(high_quality)},
1533
1534
  )
1534
1535
 
1535
1536
  async def get_package_camera_snapshot(
@@ -2119,6 +2120,17 @@ class ProtectApiClient(BaseApiClient):
2119
2120
 
2120
2121
  return response["data"]["full_api_key"]
2121
2122
 
2123
+ def set_api_key(self, api_key: str) -> None:
2124
+ """Set the API key for the NVR."""
2125
+ if not api_key:
2126
+ raise BadRequest("API key cannot be empty")
2127
+
2128
+ self._api_key = api_key
2129
+
2130
+ def is_api_key_set(self) -> bool:
2131
+ """Check if the API key is set."""
2132
+ return bool(self._api_key)
2133
+
2122
2134
  async def get_meta_info(self) -> MetaInfo:
2123
2135
  """Get metadata about the NVR."""
2124
2136
  data = await self.api_request(
uiprotect/utils.py CHANGED
@@ -700,3 +700,8 @@ def make_required_getter(ufp_required_field: str) -> Callable[[T], bool]:
700
700
  @lru_cache
701
701
  def timedelta_total_seconds(td: timedelta) -> float:
702
702
  return td.total_seconds()
703
+
704
+
705
+ def pybool_to_json_bool(value: bool) -> str:
706
+ """Convert a Python bool to a JSON boolean string ('true'/'false')."""
707
+ return "true" if value else "false"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: uiprotect
3
- Version: 7.18.0
3
+ Version: 7.19.0
4
4
  Summary: Python API for Unifi Protect (Unofficial)
5
5
  License: MIT
6
6
  Author: UI Protect Maintainers
@@ -1,7 +1,7 @@
1
1
  uiprotect/__init__.py,sha256=Oz6i1tonIz4QWVnEPkbielJDJ3WQdwZVgYtjY4IwGAQ,636
2
2
  uiprotect/__main__.py,sha256=C_bHCOkv5qj6WMy-6ELoY3Y6HDhLxOa1a30CzmbZhsg,462
3
3
  uiprotect/_compat.py,sha256=HThmb1zQZCEssCxYYbQzFhJq8zYYlVaSnIEZabKc-6U,302
4
- uiprotect/api.py,sha256=GPCgimBo8Sz-4njUhPWhe5uEZ0ZdXKuZ8xlKOwdN9vk,73812
4
+ uiprotect/api.py,sha256=JI1jPXYPv3UP1DkxzdJiytAq7S5xQ93MwokoK3h0D5c,74181
5
5
  uiprotect/cli/__init__.py,sha256=J5KE7Wt_rIr55EdGxfTOCoGfBzO5gzO5WvaruXp5AZI,9688
6
6
  uiprotect/cli/aiports.py,sha256=22sC-OVkUFfBGJR2oID8QzWsk4GQfLEmam06-LBP2Z0,1545
7
7
  uiprotect/cli/backup.py,sha256=lC44FujSYgVBUs32CbsY8pBejO4qScy6U94UzO-l2fc,36742
@@ -30,10 +30,10 @@ uiprotect/release_cache.json,sha256=NamnSFy78hOWY0DPO87J9ELFCAN6NnVquv8gQO75ZG4,
30
30
  uiprotect/stream.py,sha256=ls65vMOXF4IlJ5axewFITfhcaTh_ihaFeCkCTfhy0Nk,5168
31
31
  uiprotect/test_util/__init__.py,sha256=O22HGFX5Mb0j9LPzO48tm4ZqZTqGVBHo0jnye2FdT_I,19803
32
32
  uiprotect/test_util/anonymize.py,sha256=f-8ijU-_y9r-uAbhIPn0f0I6hzJpAkvJzc8UpWihObI,8478
33
- uiprotect/utils.py,sha256=2fLwXN0oz9dcVTFexzLp8jj97lcYrxLZkeEUGf5ehtU,20587
33
+ uiprotect/utils.py,sha256=4EIblOcOxlApiXkI2rwram4SkgiMu_JTDRIZOul83Bc,20749
34
34
  uiprotect/websocket.py,sha256=ww-PberFztJppRQMKwdu5A9gyofepV-Y6am4Hj_DV44,8178
35
- uiprotect-7.18.0.dist-info/LICENSE,sha256=INx18jhdbVXMEiiBANeKEbrbz57ckgzxk5uutmmcxGk,1111
36
- uiprotect-7.18.0.dist-info/METADATA,sha256=Fmu8ppuTcuiGR83DCE5iQkFufCwTx5Eh1WWYKi_s9Xc,11167
37
- uiprotect-7.18.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
38
- uiprotect-7.18.0.dist-info/entry_points.txt,sha256=J78AUTPrTTxgI3s7SVgrmGqDP7piX2wuuEORzhDdVRA,47
39
- uiprotect-7.18.0.dist-info/RECORD,,
35
+ uiprotect-7.19.0.dist-info/LICENSE,sha256=INx18jhdbVXMEiiBANeKEbrbz57ckgzxk5uutmmcxGk,1111
36
+ uiprotect-7.19.0.dist-info/METADATA,sha256=U0NDF6bdieT_aTNRjacByZrE1NtB1VYT7RA1aFjoZl4,11167
37
+ uiprotect-7.19.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
38
+ uiprotect-7.19.0.dist-info/entry_points.txt,sha256=J78AUTPrTTxgI3s7SVgrmGqDP7piX2wuuEORzhDdVRA,47
39
+ uiprotect-7.19.0.dist-info/RECORD,,