uiprotect 0.3.6__py3-none-any.whl → 0.3.8__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/cli/base.py CHANGED
@@ -14,6 +14,11 @@ from uiprotect.data import NVR, ProtectAdoptableDeviceModel, ProtectBaseObject
14
14
  from uiprotect.exceptions import BadRequest, NvrError, StreamError
15
15
  from uiprotect.utils import run_async
16
16
 
17
+ try:
18
+ from pydantic.v1 import ValidationError
19
+ except ImportError:
20
+ from pydantic import ValidationError # type: ignore[assignment]
21
+
17
22
  T = TypeVar("T")
18
23
 
19
24
  OPTION_FORCE = typer.Option(False, "-f", "--force", help="Skip confirmation prompt")
uiprotect/data/base.py CHANGED
@@ -11,9 +11,6 @@ from ipaddress import IPv4Address
11
11
  from typing import TYPE_CHECKING, Any, ClassVar, TypeVar
12
12
  from uuid import UUID
13
13
 
14
- from pydantic.v1 import BaseModel
15
- from pydantic.v1.fields import SHAPE_DICT, SHAPE_LIST, PrivateAttr
16
-
17
14
  from uiprotect.data.types import (
18
15
  ModelType,
19
16
  PercentFloat,
@@ -37,10 +34,20 @@ from uiprotect.utils import (
37
34
  to_snake_case,
38
35
  )
39
36
 
37
+ try:
38
+ from pydantic.v1 import BaseModel
39
+ from pydantic.v1.fields import SHAPE_DICT, SHAPE_LIST, PrivateAttr
40
+ except ImportError:
41
+ from pydantic import BaseModel # type: ignore[assignment, no-redef]
42
+ from pydantic.fields import ( # type: ignore[attr-defined, assignment, no-redef]
43
+ SHAPE_DICT,
44
+ SHAPE_LIST,
45
+ PrivateAttr,
46
+ )
47
+
40
48
  if TYPE_CHECKING:
41
49
  from asyncio.events import TimerHandle
42
50
 
43
- from pydantic.v1.typing import DictStrAny, SetStr
44
51
  from typing_extensions import Self # requires Python 3.11+
45
52
 
46
53
  from uiprotect.api import ProtectApiClient
@@ -48,6 +55,14 @@ if TYPE_CHECKING:
48
55
  from uiprotect.data.nvr import Event
49
56
  from uiprotect.data.user import User
50
57
 
58
+ try:
59
+ from pydantic.v1.typing import DictStrAny, SetStr
60
+ except ImportError:
61
+ from pydantic.typing import ( # type: ignore[assignment, no-redef]
62
+ DictStrAny,
63
+ SetStr,
64
+ )
65
+
51
66
 
52
67
  ProtectObject = TypeVar("ProtectObject", bound="ProtectBaseObject")
53
68
  RECENT_EVENT_MAX = timedelta(seconds=30)
@@ -11,7 +11,11 @@ from typing import Any, cast
11
11
  from uuid import UUID
12
12
 
13
13
  from aiohttp.client_exceptions import ServerDisconnectedError
14
- from pydantic.v1 import PrivateAttr, ValidationError
14
+
15
+ try:
16
+ from pydantic.v1 import PrivateAttr, ValidationError
17
+ except ImportError:
18
+ from pydantic import PrivateAttr, ValidationError # type: ignore[assignment]
15
19
 
16
20
  from uiprotect.data.base import (
17
21
  RECENT_EVENT_MAX,
uiprotect/data/devices.py CHANGED
@@ -12,7 +12,10 @@ from ipaddress import IPv4Address
12
12
  from pathlib import Path
13
13
  from typing import TYPE_CHECKING, Any, Literal, cast
14
14
 
15
- from pydantic.v1.fields import PrivateAttr
15
+ try:
16
+ from pydantic.v1.fields import PrivateAttr
17
+ except ImportError:
18
+ from pydantic.fields import PrivateAttr
16
19
 
17
20
  from uiprotect.data.base import (
18
21
  EVENT_PING_INTERVAL,
uiprotect/data/nvr.py CHANGED
@@ -15,7 +15,6 @@ from uuid import UUID
15
15
  import aiofiles
16
16
  import orjson
17
17
  from aiofiles import os as aos
18
- from pydantic.v1.fields import PrivateAttr
19
18
 
20
19
  from uiprotect.data.base import (
21
20
  ProtectBaseObject,
@@ -58,8 +57,16 @@ from uiprotect.data.user import User, UserLocation
58
57
  from uiprotect.exceptions import BadRequest, NotAuthorized
59
58
  from uiprotect.utils import RELEASE_CACHE, process_datetime
60
59
 
60
+ try:
61
+ from pydantic.v1.fields import PrivateAttr
62
+ except ImportError:
63
+ from pydantic.fields import PrivateAttr
64
+
61
65
  if TYPE_CHECKING:
62
- from pydantic.v1.typing import SetStr
66
+ try:
67
+ from pydantic.v1.typing import SetStr
68
+ except ImportError:
69
+ from pydantic.typing import SetStr # type: ignore[assignment, no-redef]
63
70
 
64
71
 
65
72
  _LOGGER = logging.getLogger(__name__)
uiprotect/data/types.py CHANGED
@@ -5,9 +5,18 @@ from collections.abc import Callable, Coroutine
5
5
  from typing import Any, Literal, Optional, TypeVar, Union
6
6
 
7
7
  from packaging.version import Version as BaseVersion
8
- from pydantic.v1 import BaseModel, ConstrainedInt
9
- from pydantic.v1.color import Color as BaseColor
10
- from pydantic.v1.types import ConstrainedFloat, ConstrainedStr
8
+
9
+ try:
10
+ from pydantic.v1 import BaseModel, ConstrainedInt
11
+ from pydantic.v1.color import Color as BaseColor
12
+ from pydantic.v1.types import ConstrainedFloat, ConstrainedStr
13
+ except ImportError:
14
+ from pydantic import BaseModel, ConstrainedInt # type: ignore[assignment, no-redef]
15
+ from pydantic.color import Color as BaseColor # type: ignore[assignment, no-redef]
16
+ from pydantic.types import ( # type: ignore[assignment, no-redef]
17
+ ConstrainedFloat,
18
+ ConstrainedStr,
19
+ )
11
20
 
12
21
  KT = TypeVar("KT")
13
22
  VT = TypeVar("VT")
uiprotect/data/user.py CHANGED
@@ -6,7 +6,10 @@ from datetime import datetime
6
6
  from functools import cache
7
7
  from typing import Any
8
8
 
9
- from pydantic.v1.fields import PrivateAttr
9
+ try:
10
+ from pydantic.v1.fields import PrivateAttr
11
+ except ImportError:
12
+ from pydantic.fields import PrivateAttr
10
13
 
11
14
  from uiprotect.data.base import ProtectBaseObject, ProtectModel, ProtectModelWithId
12
15
  from uiprotect.data.types import ModelType, PermissionNode
uiprotect/utils.py CHANGED
@@ -28,8 +28,6 @@ from uuid import UUID
28
28
 
29
29
  import jwt
30
30
  from aiohttp import ClientResponse
31
- from pydantic.v1.fields import SHAPE_DICT, SHAPE_LIST, SHAPE_SET, ModelField
32
- from pydantic.v1.utils import to_camel
33
31
 
34
32
  from uiprotect.data.types import (
35
33
  Color,
@@ -40,6 +38,18 @@ from uiprotect.data.types import (
40
38
  )
41
39
  from uiprotect.exceptions import NvrError
42
40
 
41
+ try:
42
+ from pydantic.v1.fields import SHAPE_DICT, SHAPE_LIST, SHAPE_SET, ModelField
43
+ from pydantic.v1.utils import to_camel
44
+ except ImportError:
45
+ from pydantic.fields import ( # type: ignore[assignment, no-redef, attr-defined]
46
+ SHAPE_DICT,
47
+ SHAPE_LIST,
48
+ SHAPE_SET,
49
+ ModelField,
50
+ )
51
+ from pydantic.utils import to_camel # type: ignore[assignment, no-redef]
52
+
43
53
  if TYPE_CHECKING:
44
54
  from uiprotect.api import ProtectApiClient
45
55
  from uiprotect.data import CoordType, Event
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: uiprotect
3
- Version: 0.3.6
3
+ Version: 0.3.8
4
4
  Summary: Python API for Unifi Protect (Unofficial)
5
5
  Home-page: https://github.com/uilibs/uiprotect
6
6
  License: MIT
@@ -78,7 +78,7 @@ Description-Content-Type: text/markdown
78
78
 
79
79
  ---
80
80
 
81
- Python API for Unifi Protect (Unofficial)
81
+ Python API for UniFi Protect (Unofficial)
82
82
 
83
83
  ## Looking for maintainers
84
84
 
@@ -126,7 +126,7 @@ Smart Detections (person, vehicle, animal, face), a feature that previously coul
126
126
 
127
127
  Enabling Remote Access may grant other users access to your console [due to the fact Ubiquiti can reconfigure access controls at any time](https://community.ui.com/questions/Bug-Fix-Cloud-Access-Misconfiguration/fe8d4479-e187-4471-bf95-b2799183ceb7).
128
128
 
129
- If you are not okay with the feature being locked behind Remote Access access, [let Ubiquiti know](https://community.ui.com/questions/Cannot-enable-Smart-Detections/e3d50641-5c00-4607-9723-453cda557e35).
129
+ If you are not okay with the feature being locked behind Remote Access, [let Ubiquiti know](https://community.ui.com/questions/Cannot-enable-Smart-Detections/e3d50641-5c00-4607-9723-453cda557e35).
130
130
 
131
131
  ## Documentation
132
132
 
@@ -140,7 +140,7 @@ If you want to install `uiprotect` natively, the below are the requirements:
140
140
  - Latest version of library is generally only tested against the two latest minor version. This is either two latest stable versions (such as 1.21.x and 2.0.x) or the latest EA version and stable version (such as 2.2.x EA and 2.1.x).
141
141
  - [Python](https://www.python.org/) 3.10+
142
142
  - POSIX compatible system
143
- - Library is only tested on Linux, specifically the latest Debian version available for the official Python Docker images, but there is no reason the library should not work on any Linux distro or MacOS.
143
+ - Library is only tested on Linux, specifically the latest Debian version available for the official Python Docker images, but there is no reason the library should not work on any Linux distro or macOS.
144
144
  - [ffmpeg](https://ffmpeg.org/)
145
145
  - ffmpeg is primarily only for streaming audio to Protect cameras, this can be considered a soft requirement
146
146
 
@@ -158,7 +158,7 @@ Windows is **not supported**. If you need to use `uiprotect` on Windows, use Doc
158
158
  pip install uiprotect
159
159
  ```
160
160
 
161
- ### From Github
161
+ ### From GitHub
162
162
 
163
163
  ```bash
164
164
  pip install git+https://github.com/uilibs/uiprotect.git#egg=uiprotect
@@ -166,7 +166,7 @@ pip install git+https://github.com/uilibs/uiprotect.git#egg=uiprotect
166
166
 
167
167
  ### Using Docker Container
168
168
 
169
- A Docker container is also provided so you do not need to install/manage Python as well. You can add the following to your `.bashrc` or similar.
169
+ A Docker container is also provided, so you do not need to install/manage Python as well. You can add the following to your `.bashrc` or similar.
170
170
 
171
171
  ```bash
172
172
  function uiprotect() {
@@ -181,11 +181,11 @@ function uiprotect() {
181
181
  }
182
182
  ```
183
183
 
184
- Some notes about the Docker version since it is running inside of a container:
184
+ Some notes about the Docker version since it is running inside a container:
185
185
 
186
186
  - You can update at any time using the command `docker pull ghcr.io/uilibs/uiprotect:latest`
187
187
  - Your local current working directory (`$PWD`) will automatically be mounted to `/data` inside of the container. For commands that output files, this is the _only_ path you can write to and have the file persist.
188
- - The container supports `linux/amd64` and `linux/arm64` natively. This means it will also work well on MacOS or Windows using Docker Desktop.
188
+ - The container supports `linux/amd64` and `linux/arm64` natively. This means it will also work well on macOS or Windows using Docker Desktop.
189
189
  - `TZ` should be the [Olson timezone name](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) for the timezone your UniFi Protect instance is in.
190
190
  - For more details on `TZ` and other environment variables, check the [command line docs](https://uilibs.github.io/uiprotect/latest/cli/)
191
191
 
@@ -193,8 +193,8 @@ Some notes about the Docker version since it is running inside of a container:
193
193
 
194
194
  ### CLI
195
195
 
196
- !!! warning "About Ubiquiti SSO accounts"
197
- Ubiquiti SSO accounts are not supported and actively discouraged from being used. There is no option to use MFA. You are expected to use local access user. `uiprotect` is not designed to allow you to use your owner account to access the console or to be used over the public Internet as both pose a security risk.
196
+ > [!WARNING]
197
+ > Ubiquiti SSO accounts are not supported and actively discouraged from being used. There is no option to use MFA. You are expected to use local access user. `uiprotect` is not designed to allow you to use your owner account to access the console or to be used over the public internet as both pose a security risk.
198
198
 
199
199
  ```bash
200
200
  export UFP_USERNAME=YOUR_USERNAME_HERE
@@ -242,13 +242,15 @@ Generally any feature missing from the library is planned to be done eventually
242
242
 
243
243
  ### UniFi OS Features
244
244
 
245
- Anything that is strictly a UniFi OS feature. If it ever done, it will be in a separate library that interacts with this one. Examples include:
245
+ Anything that is strictly a UniFi OS feature. If it is ever done, it will be in a separate library that interacts with this one. Examples include:
246
246
 
247
247
  - Managing RAID and disks
248
248
  - Creating and managing users
249
249
 
250
- Examples include:
250
+ ### Remote Access / Ubiquiti Cloud Features
251
+
252
+ Some features that require an Ubiquiti Account or "Remote Access" to be enabled are currently not implemented. Examples include:
251
253
 
252
254
  - Stream sharing
253
- - Smart Detections, including person, vehicle, animals license plate and faces
255
+ - Face detection
254
256
 
@@ -3,7 +3,7 @@ uiprotect/__main__.py,sha256=T69KE5W4zek6qeNEL8_Fq2DEfBc04SqSuIOJpiW4ydE,471
3
3
  uiprotect/api.py,sha256=mmAmPBs0Zev_2KWLO_l5QU8pFOsFzuYt-OZMvfV3mq0,65694
4
4
  uiprotect/cli/__init__.py,sha256=tmwtYrhM8rjOw8noKD6NALl_2Nu3xIycDuQyEKD5oMk,8832
5
5
  uiprotect/cli/backup.py,sha256=Mtjd2f0w7zjIeLkJILKxiBnZJYXypzC9gpyAmBZ8sq0,36746
6
- uiprotect/cli/base.py,sha256=IyK_JZbw7C6m8R46iMzfVOs4on5TpedFxaDrYz_v_0g,7623
6
+ uiprotect/cli/base.py,sha256=dE6vYb4nLAYbUdHwcKkN7I3iXqTjz84jfHGnsLmk_Ds,7762
7
7
  uiprotect/cli/cameras.py,sha256=mVLJ5FjZPSbpNXvtd7Yiz17zMDSdLWT0p6Wcaqpt0GQ,16996
8
8
  uiprotect/cli/chimes.py,sha256=92kNiZN7FpuCF7CqK9oLPt2jQ96tNhTjP1JcOdJAKhU,5350
9
9
  uiprotect/cli/doorlocks.py,sha256=XMftrrK0O0bWZHOuTwg9m4p9U7gC0FzHFb72bSnlUEg,3547
@@ -14,13 +14,13 @@ uiprotect/cli/nvr.py,sha256=PVpUitWzP9HLy2yoj0HP-b-4Te5AFCrahUAmrQJ4z-w,4276
14
14
  uiprotect/cli/sensors.py,sha256=CE77weDkYepo9eEs1J0ModIs3pWNWmesjAq3rlmiez0,8177
15
15
  uiprotect/cli/viewers.py,sha256=SZlolZH3kkcWKjATrA37TCVZYRpF0t4cCccrC8vIv-M,2195
16
16
  uiprotect/data/__init__.py,sha256=38Kb1DVi4kv9FTTwugatPNSWLiIp6uvUlTMZRQp2jTY,3050
17
- uiprotect/data/base.py,sha256=k65F05OHN2l-nlQ5bVeXxTSYvvGj7pZz_jfe2KmWOSk,37423
18
- uiprotect/data/bootstrap.py,sha256=d3SmJa4SJkosNc_Ve_ySPnRxtIfxXdioTmAoczuz3YQ,21738
17
+ uiprotect/data/base.py,sha256=YJ0iofoy1K3EG55npokU3T2CLRC8kctutfIy0Sq_6Sg,37850
18
+ uiprotect/data/bootstrap.py,sha256=bRuJ4QhizoVd_dbmpO5Wpd2NlHHkqtrPz4mO-e11A9M,21850
19
19
  uiprotect/data/convert.py,sha256=f8QkwZnlNbV_W-YognlDvZ1gQKp5yFuC50396hcu6DU,2127
20
- uiprotect/data/devices.py,sha256=RMucQXXAyN6VwLvFZwsxauStwXZkdQGUITSZ9h_iQXY,112765
21
- uiprotect/data/nvr.py,sha256=eDfSAeOvaI1bHrpkZReW76934lrEBz8GKOfxDfq7xlw,47485
22
- uiprotect/data/types.py,sha256=5eLL2jBl1eHiMwxbL6l0qngsmhg1F0dBrAS5GtDVdgg,15427
23
- uiprotect/data/user.py,sha256=c-rslssNHhHOYplPE5lGGfuDexvI0mVYhbb6Xyi5dgo,7022
20
+ uiprotect/data/devices.py,sha256=QMIbCEhgMehBemCUPzVJnSQG4O-BfHfnQ88lpOnbDWg,112838
21
+ uiprotect/data/nvr.py,sha256=JZja0QiT91Eu8-lw_M0Ora1KGNXhbG5dVNLN8YdeSw0,47677
22
+ uiprotect/data/types.py,sha256=XYFop75mOip0dbJeejitX9r5MJDFmblCk__QiWuDzCQ,15769
23
+ uiprotect/data/user.py,sha256=HZJh9IOXS23kM-szTn7dGGsRZz9w2_9DqltL90gcMoE,7095
24
24
  uiprotect/data/websocket.py,sha256=HKAze9b9soOS03_2zixRTR7jlFIA4ph9wMZEo15q6NY,6107
25
25
  uiprotect/exceptions.py,sha256=kgn0cRM6lTtgLza09SDa3ZiX6ue1QqHCOogQ4qu6KTQ,965
26
26
  uiprotect/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -28,10 +28,10 @@ uiprotect/release_cache.json,sha256=NamnSFy78hOWY0DPO87J9ELFCAN6NnVquv8gQO75ZG4,
28
28
  uiprotect/stream.py,sha256=V4aJfVWpSUsWE1PQrXH8F7obQQi1ukPAZ7PzwABjt0I,4942
29
29
  uiprotect/test_util/__init__.py,sha256=sSEXu6_pwdYNQSCYtftpX1Dy1S8XYOvhrpECYRxeKJE,18596
30
30
  uiprotect/test_util/anonymize.py,sha256=AGYELhDC4BrdK0deI6zh5jFp3SuM_HvAWLeoxFHSiwg,8486
31
- uiprotect/utils.py,sha256=kGh1DcejItZ0_XEoAQNVZMtU1w9JHIeNSvm3T-llSxs,17841
31
+ uiprotect/utils.py,sha256=xP8t0wEBIGS___LUYRNnQuXvUbjKDbsOnnSwWDzphSw,18124
32
32
  uiprotect/websocket.py,sha256=iMTdchymaCgVHsmY1bRbxkcymqt6WQircIHYNxCu178,7289
33
- uiprotect-0.3.6.dist-info/LICENSE,sha256=INx18jhdbVXMEiiBANeKEbrbz57ckgzxk5uutmmcxGk,1111
34
- uiprotect-0.3.6.dist-info/METADATA,sha256=M6jZfOWKuUN1s8lZImsBONe7DpPX-BKIx_Ekurbf5kE,10923
35
- uiprotect-0.3.6.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
36
- uiprotect-0.3.6.dist-info/entry_points.txt,sha256=J78AUTPrTTxgI3s7SVgrmGqDP7piX2wuuEORzhDdVRA,47
37
- uiprotect-0.3.6.dist-info/RECORD,,
33
+ uiprotect-0.3.8.dist-info/LICENSE,sha256=INx18jhdbVXMEiiBANeKEbrbz57ckgzxk5uutmmcxGk,1111
34
+ uiprotect-0.3.8.dist-info/METADATA,sha256=UwhxSR3p6GWaUnkOvIMVC3_Z4UEaLB717rRLyl_9B88,10984
35
+ uiprotect-0.3.8.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
36
+ uiprotect-0.3.8.dist-info/entry_points.txt,sha256=J78AUTPrTTxgI3s7SVgrmGqDP7piX2wuuEORzhDdVRA,47
37
+ uiprotect-0.3.8.dist-info/RECORD,,