uiprotect 6.0.2__py3-none-any.whl → 6.2.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
@@ -11,13 +11,13 @@ import sys
11
11
  import time
12
12
  from collections.abc import Callable
13
13
  from datetime import datetime, timedelta
14
- from functools import cached_property, partial
14
+ from functools import partial
15
15
  from http import HTTPStatus
16
16
  from http.cookies import Morsel, SimpleCookie
17
17
  from ipaddress import IPv4Address, IPv6Address
18
18
  from pathlib import Path
19
19
  from typing import Any, Literal, cast
20
- from urllib.parse import urljoin
20
+ from urllib.parse import SplitResult
21
21
 
22
22
  import aiofiles
23
23
  import aiohttp
@@ -25,6 +25,7 @@ import orjson
25
25
  from aiofiles import os as aos
26
26
  from aiohttp import CookieJar, client_exceptions
27
27
  from platformdirs import user_cache_dir, user_config_dir
28
+ from propcache import cached_property
28
29
  from yarl import URL
29
30
 
30
31
  from .data import (
@@ -327,7 +328,9 @@ class BaseApiClient:
327
328
  if require_auth:
328
329
  await self.ensure_authenticated()
329
330
 
330
- request_url = self._url.joinpath(url[1:])
331
+ request_url = self._url.join(
332
+ URL(SplitResult("", "", url, "", ""), encoded=True)
333
+ )
331
334
  headers = kwargs.get("headers") or self.headers
332
335
  _LOGGER.debug("Request url: %s", request_url)
333
336
  if not self._verify_ssl:
@@ -387,10 +390,9 @@ class BaseApiClient:
387
390
  **kwargs: Any,
388
391
  ) -> bytes | None:
389
392
  """Make a request to UniFi Protect API"""
390
- url = urljoin(self.api_path, url)
391
393
  response = await self.request(
392
394
  method,
393
- url,
395
+ f"{self.api_path}{url}",
394
396
  require_auth=require_auth,
395
397
  auto_close=False,
396
398
  **kwargs,
@@ -1542,7 +1544,7 @@ class ProtectApiClient(BaseApiClient):
1542
1544
 
1543
1545
  r = await self.request(
1544
1546
  "get",
1545
- urljoin(self.api_path, path),
1547
+ f"{self.api_path}{path}",
1546
1548
  auto_close=False,
1547
1549
  timeout=0,
1548
1550
  params=params,
uiprotect/data/base.py CHANGED
@@ -6,12 +6,13 @@ import asyncio
6
6
  import logging
7
7
  from collections.abc import Callable
8
8
  from datetime import datetime, timedelta
9
- from functools import cache, cached_property
9
+ from functools import cache
10
10
  from ipaddress import IPv4Address
11
11
  from typing import TYPE_CHECKING, Any, NamedTuple, TypeVar
12
12
  from uuid import UUID
13
13
 
14
14
  from convertertools import pop_dict_set_if_none, pop_dict_tuple
15
+ from propcache import cached_property
15
16
  from pydantic.v1 import BaseModel
16
17
  from pydantic.v1.fields import SHAPE_DICT, SHAPE_LIST, PrivateAttr
17
18
 
uiprotect/data/types.py CHANGED
@@ -2,10 +2,11 @@ from __future__ import annotations
2
2
 
3
3
  import enum
4
4
  from collections.abc import Callable, Coroutine
5
- from functools import cache, cached_property
5
+ from functools import cache
6
6
  from typing import Any, Literal, Optional, TypeVar, Union
7
7
 
8
8
  from packaging.version import Version as BaseVersion
9
+ from propcache import cached_property
9
10
  from pydantic.v1 import BaseModel, ConstrainedInt
10
11
  from pydantic.v1.color import Color as BaseColor
11
12
  from pydantic.v1.types import ConstrainedFloat, ConstrainedStr
@@ -274,6 +275,8 @@ class EventType(str, ValuesEnumMixin, enum.Enum):
274
275
  EventType.MOTION.value,
275
276
  EventType.RING.value,
276
277
  EventType.SMART_DETECT.value,
278
+ EventType.SMART_AUDIO_DETECT.value,
279
+ EventType.SMART_DETECT_LINE.value,
277
280
  ]
278
281
 
279
282
  @staticmethod
@@ -7,10 +7,11 @@ import enum
7
7
  import struct
8
8
  import zlib
9
9
  from dataclasses import dataclass
10
- from functools import cache, cached_property
10
+ from functools import cache
11
11
  from typing import TYPE_CHECKING, Any
12
12
 
13
13
  import orjson
14
+ from propcache import cached_property
14
15
 
15
16
  from ..exceptions import WSDecodeError, WSEncodeError
16
17
  from .types import ProtectWSPayloadFormat
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: uiprotect
3
- Version: 6.0.2
3
+ Version: 6.2.0
4
4
  Summary: Python API for Unifi Protect (Unofficial)
5
5
  Home-page: https://github.com/uilibs/uiprotect
6
6
  Author: UI Protect Maintainers
@@ -27,6 +27,7 @@ Requires-Dist: orjson (>=3.9.15)
27
27
  Requires-Dist: packaging (>=23)
28
28
  Requires-Dist: pillow (>=10)
29
29
  Requires-Dist: platformdirs (>=4)
30
+ Requires-Dist: propcache (>=0.0.0)
30
31
  Requires-Dist: pydantic (>=1.10.17)
31
32
  Requires-Dist: pyjwt (>=2.6)
32
33
  Requires-Dist: rich (>=10)
@@ -1,6 +1,6 @@
1
1
  uiprotect/__init__.py,sha256=GDRM9WvWUBbOyBVgltq6Qv8i7LVdWEbG8q5EzYvOFbE,636
2
2
  uiprotect/__main__.py,sha256=C_bHCOkv5qj6WMy-6ELoY3Y6HDhLxOa1a30CzmbZhsg,462
3
- uiprotect/api.py,sha256=8kC9v6EM67kfdtPDIW8dlqjZl_s5Lffj4o-Z_dOMmdQ,67894
3
+ uiprotect/api.py,sha256=n3pdvVR9B7_qs19pylI8S-NlXUVluTCZHnTMfRpcZis,67955
4
4
  uiprotect/cli/__init__.py,sha256=1MO8rJmjjAsfVx2x01gn5DJo8B64xdPGo6gRVJbWd18,8868
5
5
  uiprotect/cli/backup.py,sha256=ZiS7RZnJGKI8TJKLW2cOUzkRM8nyTvE5Ov_jZZGtvSM,36708
6
6
  uiprotect/cli/base.py,sha256=k-_qGuNT7br0iV0KE5F4wYXF75iyLLjBEckTqxC71xM,7591
@@ -14,14 +14,14 @@ uiprotect/cli/nvr.py,sha256=TwxEg2XT8jXAbOqv6gc7KFXELKadeItEDYweSL4_-e8,4260
14
14
  uiprotect/cli/sensors.py,sha256=fQtcDJCVxs4VbAqcavgBy2ABiVxAW3GXtna6_XFBp2k,8153
15
15
  uiprotect/cli/viewers.py,sha256=2cyrp104ffIvgT0wYGIO0G35QMkEbFe7fSVqLwDXQYQ,2171
16
16
  uiprotect/data/__init__.py,sha256=OcfuJl2qXfHcj_mdnrHhzZ5tEIZrw8auziX5IE7dn-I,2938
17
- uiprotect/data/base.py,sha256=J2ytJqWJIsFq7vXYG4gfp2c-mrj5gqa3UhmItF0MWbI,35033
17
+ uiprotect/data/base.py,sha256=36hd_aRh58DOkxZVEmCfsFDdMeHC3292ogiRtNRcBJ8,35054
18
18
  uiprotect/data/bootstrap.py,sha256=OSPHu08p7Ys9KqEb8sq_LFufuECtF4lY7OnAYK27ngo,20454
19
19
  uiprotect/data/convert.py,sha256=8h6Il_DhMkPRDPj9F_rA2UZIlTuchS3BQD24peKpk2A,2185
20
20
  uiprotect/data/devices.py,sha256=0l8eiTCwacdHCmOc7qNzeUMpHLxvd6FeB7DOqZKycdA,110880
21
21
  uiprotect/data/nvr.py,sha256=8M-62AG4q1k71eX-DaFcdO52QWG4zO9X5Voj0Tj9D5A,46598
22
- uiprotect/data/types.py,sha256=zYQjmFDqxjVzaan-vihOzHaBirWsW_C0Q3Pd9xTH33I,18214
22
+ uiprotect/data/types.py,sha256=IucBrw8rKEB1ia2r1HttdL5QHUDxGUUZhXpTE0kcaM8,18330
23
23
  uiprotect/data/user.py,sha256=1o5gyPHafn4lHARpoSMD_NWbo5IbzGPfiSASwqqDvWs,7002
24
- uiprotect/data/websocket.py,sha256=5-yM6yr8NrxKJjBPQlGVXXQUTcksF-UavligKYjJQ3k,6770
24
+ uiprotect/data/websocket.py,sha256=gjgey5OcnRPJByD4Z3jW-nLN_jDM_nkQSYdGOkuV5IU,6791
25
25
  uiprotect/exceptions.py,sha256=kgn0cRM6lTtgLza09SDa3ZiX6ue1QqHCOogQ4qu6KTQ,965
26
26
  uiprotect/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
27
27
  uiprotect/release_cache.json,sha256=NamnSFy78hOWY0DPO87J9ELFCAN6NnVquv8gQO75ZG4,386
@@ -30,8 +30,8 @@ uiprotect/test_util/__init__.py,sha256=Ky8mTL61nhp5II2mxTKBAsSGvNqK8U_CfKC5AGwTo
30
30
  uiprotect/test_util/anonymize.py,sha256=f-8ijU-_y9r-uAbhIPn0f0I6hzJpAkvJzc8UpWihObI,8478
31
31
  uiprotect/utils.py,sha256=jIWT7n_reL90oY91svBfQ4naRxo28qHzP5jNOL12mQE,20342
32
32
  uiprotect/websocket.py,sha256=xCeEGB49IIBoAh1S8dqi6e8GM-SH66joTkf1BItq9vY,8093
33
- uiprotect-6.0.2.dist-info/LICENSE,sha256=INx18jhdbVXMEiiBANeKEbrbz57ckgzxk5uutmmcxGk,1111
34
- uiprotect-6.0.2.dist-info/METADATA,sha256=Fnj72kFn6o1TD8jkN2ZDTaqtl-dmBk8RlcH0-nHB6RI,11010
35
- uiprotect-6.0.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
36
- uiprotect-6.0.2.dist-info/entry_points.txt,sha256=J78AUTPrTTxgI3s7SVgrmGqDP7piX2wuuEORzhDdVRA,47
37
- uiprotect-6.0.2.dist-info/RECORD,,
33
+ uiprotect-6.2.0.dist-info/LICENSE,sha256=INx18jhdbVXMEiiBANeKEbrbz57ckgzxk5uutmmcxGk,1111
34
+ uiprotect-6.2.0.dist-info/METADATA,sha256=LX_6VisKf6gv9YqqkFrbRP4tdO9fr0ALrnTSpx0epOs,11045
35
+ uiprotect-6.2.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
36
+ uiprotect-6.2.0.dist-info/entry_points.txt,sha256=J78AUTPrTTxgI3s7SVgrmGqDP7piX2wuuEORzhDdVRA,47
37
+ uiprotect-6.2.0.dist-info/RECORD,,