python-terminusgps 1.3.0__tar.gz → 1.4.0__tar.gz
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 python-terminusgps might be problematic. Click here for more details.
- {python_terminusgps-1.3.0 → python_terminusgps-1.4.0}/PKG-INFO +1 -1
- {python_terminusgps-1.3.0 → python_terminusgps-1.4.0}/pyproject.toml +1 -1
- python_terminusgps-1.4.0/terminusgps/wialon/items/account.py +25 -0
- {python_terminusgps-1.3.0 → python_terminusgps-1.4.0}/terminusgps/wialon/items/base.py +0 -2
- {python_terminusgps-1.3.0 → python_terminusgps-1.4.0}/terminusgps/wialon/items/resource.py +7 -5
- {python_terminusgps-1.3.0 → python_terminusgps-1.4.0}/terminusgps/wialon/items/retranslator.py +3 -3
- {python_terminusgps-1.3.0 → python_terminusgps-1.4.0}/terminusgps/wialon/items/route.py +6 -4
- {python_terminusgps-1.3.0 → python_terminusgps-1.4.0}/terminusgps/wialon/items/unit.py +3 -3
- {python_terminusgps-1.3.0 → python_terminusgps-1.4.0}/terminusgps/wialon/items/unit_group.py +14 -16
- {python_terminusgps-1.3.0 → python_terminusgps-1.4.0}/terminusgps/wialon/items/user.py +3 -3
- {python_terminusgps-1.3.0 → python_terminusgps-1.4.0}/.gitignore +0 -0
- {python_terminusgps-1.3.0 → python_terminusgps-1.4.0}/COPYING +0 -0
- {python_terminusgps-1.3.0 → python_terminusgps-1.4.0}/README.md +0 -0
- {python_terminusgps-1.3.0 → python_terminusgps-1.4.0}/requirements.txt +0 -0
- {python_terminusgps-1.3.0 → python_terminusgps-1.4.0}/terminusgps/__init__.py +0 -0
- {python_terminusgps-1.3.0 → python_terminusgps-1.4.0}/terminusgps/authorizenet/__init__.py +0 -0
- {python_terminusgps-1.3.0 → python_terminusgps-1.4.0}/terminusgps/authorizenet/auth.py +0 -0
- {python_terminusgps-1.3.0 → python_terminusgps-1.4.0}/terminusgps/aws/__init__.py +0 -0
- {python_terminusgps-1.3.0 → python_terminusgps-1.4.0}/terminusgps/aws/secrets.py +0 -0
- {python_terminusgps-1.3.0 → python_terminusgps-1.4.0}/terminusgps/wialon/__init__.py +0 -0
- {python_terminusgps-1.3.0 → python_terminusgps-1.4.0}/terminusgps/wialon/constants.py +0 -0
- {python_terminusgps-1.3.0 → python_terminusgps-1.4.0}/terminusgps/wialon/errors.py +0 -0
- {python_terminusgps-1.3.0 → python_terminusgps-1.4.0}/terminusgps/wialon/flags.py +0 -0
- {python_terminusgps-1.3.0 → python_terminusgps-1.4.0}/terminusgps/wialon/items/__init__.py +0 -0
- {python_terminusgps-1.3.0 → python_terminusgps-1.4.0}/terminusgps/wialon/session.py +0 -0
- {python_terminusgps-1.3.0 → python_terminusgps-1.4.0}/terminusgps/wialon/utils.py +0 -0
- {python_terminusgps-1.3.0 → python_terminusgps-1.4.0}/uv.lock +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-terminusgps
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4.0
|
|
4
4
|
Summary: Provides abstractions/utilities for working with Wialon API, Authorize.NET API, AWS API, and more.
|
|
5
5
|
Project-URL: Documentation, https://app.terminusgps.com/docs/apps/python-terminusgps/index.html
|
|
6
6
|
Project-URL: Repository, https://github.com/terminusgps/python-terminusgps
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "python-terminusgps"
|
|
3
|
-
version = "1.
|
|
3
|
+
version = "1.4.0"
|
|
4
4
|
description = "Provides abstractions/utilities for working with Wialon API, Authorize.NET API, AWS API, and more."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
authors = [ {name = "Blake Nall", email = "blake@terminusgps.com" } ]
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from terminusgps.wialon.items.base import WialonBase
|
|
2
|
+
from terminusgps.wialon.items import WialonResource, WialonUser
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class WialonAccount(WialonBase):
|
|
6
|
+
def __init__(
|
|
7
|
+
self, billing_plan: str = "terminusgps_ext_hist", *args, **kwargs
|
|
8
|
+
) -> None:
|
|
9
|
+
super().__init__(*args, **kwargs)
|
|
10
|
+
self.billing_plan = billing_plan
|
|
11
|
+
|
|
12
|
+
def create(self, **kwargs) -> int | None:
|
|
13
|
+
if not kwargs.get("creator_id"):
|
|
14
|
+
raise ValueError("'creator_id' is required for creation.")
|
|
15
|
+
|
|
16
|
+
user = WialonUser(id=str(kwargs["creator_id"]), session=self.session)
|
|
17
|
+
resource = WialonResource(
|
|
18
|
+
creator_id=kwargs["creator_id"],
|
|
19
|
+
name=f"super_{user.name}",
|
|
20
|
+
session=self.session,
|
|
21
|
+
)
|
|
22
|
+
self.session.wialon_api.account_create_account(
|
|
23
|
+
**{"itemId": resource.id, "plan": kwargs.get("plan", self.billing_plan)}
|
|
24
|
+
)
|
|
25
|
+
return int(kwargs["resource_id"])
|
|
@@ -4,16 +4,18 @@ from terminusgps.wialon.items.base import WialonBase
|
|
|
4
4
|
|
|
5
5
|
class WialonResource(WialonBase):
|
|
6
6
|
def create(self, **kwargs) -> int | None:
|
|
7
|
-
if not kwargs.get("
|
|
8
|
-
raise ValueError("'
|
|
7
|
+
if not kwargs.get("creator_id"):
|
|
8
|
+
raise ValueError("'creator_id' is required for creation.")
|
|
9
9
|
if not kwargs.get("name"):
|
|
10
|
-
raise ValueError("'name' is required
|
|
10
|
+
raise ValueError("'name' is required for creation.")
|
|
11
|
+
if not kwargs.get("flags"):
|
|
12
|
+
kwargs["flags"] = flags.DATAFLAG_UNIT_BASE
|
|
11
13
|
|
|
12
14
|
response = self.session.wialon_api.core_create_resource(
|
|
13
15
|
**{
|
|
14
|
-
"creatorId": kwargs["
|
|
16
|
+
"creatorId": kwargs["creator_id"],
|
|
15
17
|
"name": kwargs["name"],
|
|
16
|
-
"dataFlags": flags
|
|
18
|
+
"dataFlags": kwargs["flags"],
|
|
17
19
|
"skipCreatorCheck": True,
|
|
18
20
|
}
|
|
19
21
|
)
|
{python_terminusgps-1.3.0 → python_terminusgps-1.4.0}/terminusgps/wialon/items/retranslator.py
RENAMED
|
@@ -4,8 +4,8 @@ from terminusgps.wialon.items.base import WialonBase
|
|
|
4
4
|
|
|
5
5
|
class WialonRetranslator(WialonBase):
|
|
6
6
|
def create(self, **kwargs) -> int | None:
|
|
7
|
-
if not kwargs.get("
|
|
8
|
-
raise ValueError("'
|
|
7
|
+
if not kwargs.get("creator_id"):
|
|
8
|
+
raise ValueError("'creator_id' is required on creation.")
|
|
9
9
|
if not kwargs.get("name"):
|
|
10
10
|
raise ValueError("'name' is required on creation.")
|
|
11
11
|
if not kwargs.get("config"):
|
|
@@ -13,7 +13,7 @@ class WialonRetranslator(WialonBase):
|
|
|
13
13
|
|
|
14
14
|
response = self.session.wialon_api.core_create_retranslator(
|
|
15
15
|
**{
|
|
16
|
-
"creatorId": kwargs["
|
|
16
|
+
"creatorId": kwargs["creator_id"],
|
|
17
17
|
"name": kwargs["name"],
|
|
18
18
|
"config": kwargs["config"],
|
|
19
19
|
"dataFlags": flags.DATAFLAG_UNIT_BASE,
|
|
@@ -4,16 +4,18 @@ from terminusgps.wialon.items.base import WialonBase
|
|
|
4
4
|
|
|
5
5
|
class WialonRoute(WialonBase):
|
|
6
6
|
def create(self, **kwargs) -> int | None:
|
|
7
|
-
if not kwargs.get("
|
|
8
|
-
raise ValueError("'
|
|
7
|
+
if not kwargs.get("creator_id"):
|
|
8
|
+
raise ValueError("'creator_id' is required on creation.")
|
|
9
9
|
if not kwargs.get("name"):
|
|
10
10
|
raise ValueError("'name' is required on creation.")
|
|
11
|
+
if not kwargs.get("flags"):
|
|
12
|
+
kwargs["flags"] = flags.DATAFLAG_UNIT_BASE
|
|
11
13
|
|
|
12
14
|
response = self.session.wialon_api.core_create_route(
|
|
13
15
|
**{
|
|
14
|
-
"creatorId": kwargs["
|
|
16
|
+
"creatorId": kwargs["creator_id"],
|
|
15
17
|
"name": kwargs["name"],
|
|
16
|
-
"dataFlags": flags
|
|
18
|
+
"dataFlags": kwargs["flags"],
|
|
17
19
|
}
|
|
18
20
|
)
|
|
19
21
|
return response.get("item", {}).get("id")
|
|
@@ -6,8 +6,8 @@ from terminusgps.wialon.items.base import WialonBase, repopulate
|
|
|
6
6
|
|
|
7
7
|
class WialonUnit(WialonBase):
|
|
8
8
|
def create(self, **kwargs) -> int | None:
|
|
9
|
-
if not kwargs.get("
|
|
10
|
-
raise ValueError("'
|
|
9
|
+
if not kwargs.get("creator_id"):
|
|
10
|
+
raise ValueError("'creator_id' is required on creation.")
|
|
11
11
|
if not kwargs.get("name"):
|
|
12
12
|
raise ValueError("'name' is required on creation.")
|
|
13
13
|
if not kwargs.get("hw_type"):
|
|
@@ -15,7 +15,7 @@ class WialonUnit(WialonBase):
|
|
|
15
15
|
|
|
16
16
|
response = self.session.wialon_api.core_create_unit(
|
|
17
17
|
**{
|
|
18
|
-
"creatorId": kwargs["
|
|
18
|
+
"creatorId": kwargs["creator_id"],
|
|
19
19
|
"name": kwargs["name"],
|
|
20
20
|
"hwTypeId": kwargs["hw_type"],
|
|
21
21
|
"dataFlags": flags.DATAFLAG_UNIT_BASE,
|
{python_terminusgps-1.3.0 → python_terminusgps-1.4.0}/terminusgps/wialon/items/unit_group.py
RENAMED
|
@@ -3,33 +3,32 @@ from terminusgps.wialon.items.base import WialonBase
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
class WialonUnitGroup(WialonBase):
|
|
6
|
-
def _update_items(self, new_items: list[str]) -> None:
|
|
7
|
-
self.session.wialon_api.unit_group_update_units(
|
|
8
|
-
**{"itemId": self.id, "units": new_items}
|
|
9
|
-
)
|
|
10
|
-
|
|
11
6
|
def create(self, **kwargs) -> int | None:
|
|
12
|
-
if not kwargs.get("
|
|
13
|
-
raise ValueError("'
|
|
7
|
+
if not kwargs.get("creator_id"):
|
|
8
|
+
raise ValueError("'creator_id' is required on creation.")
|
|
14
9
|
if not kwargs.get("name"):
|
|
15
10
|
raise ValueError("'name' is required on creation.")
|
|
16
11
|
|
|
17
12
|
response = self.session.wialon_api.core_create_unit_group(
|
|
18
13
|
**{
|
|
19
|
-
"creatorId": kwargs["
|
|
14
|
+
"creatorId": kwargs["creator_id"],
|
|
20
15
|
"name": kwargs["name"],
|
|
21
16
|
"dataFlags": flags.DATAFLAG_UNIT_BASE,
|
|
22
17
|
}
|
|
23
18
|
)
|
|
24
19
|
return response.get("item", {}).get("id")
|
|
25
20
|
|
|
21
|
+
def _update_items(self, new_items: list[str]) -> None:
|
|
22
|
+
self.session.wialon_api.unit_group_update_units(
|
|
23
|
+
**{"itemId": self.id, "units": new_items}
|
|
24
|
+
)
|
|
25
|
+
|
|
26
26
|
def is_member(self, item: WialonBase) -> bool:
|
|
27
27
|
return True if str(item.id) in self.items else False
|
|
28
28
|
|
|
29
|
-
def grant_access(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
def grant_access(
|
|
30
|
+
self, item: WialonBase, access_mask: int = constants.ACCESSMASK_UNIT_BASIC
|
|
31
|
+
) -> None:
|
|
33
32
|
self.session.wialon_api.user_update_item_access(
|
|
34
33
|
**{"userId": item.id, "itemId": self.id, "accessMask": access_mask}
|
|
35
34
|
)
|
|
@@ -40,18 +39,17 @@ class WialonUnitGroup(WialonBase):
|
|
|
40
39
|
)
|
|
41
40
|
|
|
42
41
|
def add_item(self, item: WialonBase) -> None:
|
|
43
|
-
new_items: list[str] = self.items + [str(item.id)]
|
|
42
|
+
new_items: list[str] = self.items.copy() + [str(item.id)]
|
|
44
43
|
self._update_items(new_items)
|
|
45
44
|
|
|
46
45
|
def rm_item(self, item: WialonBase) -> None:
|
|
47
|
-
assert self.is_member(item), "Cannot remove item, it's not in the group"
|
|
48
|
-
new_items: list[str] = self.items
|
|
46
|
+
assert self.is_member(item), f"Cannot remove {item.name}, it's not in the group"
|
|
47
|
+
new_items: list[str] = self.items.copy()
|
|
49
48
|
new_items.remove(str(item.id))
|
|
50
49
|
self._update_items(new_items)
|
|
51
50
|
|
|
52
51
|
@property
|
|
53
52
|
def items(self) -> list[str]:
|
|
54
|
-
"""Calls the Wialon API and returns a list of group member IDs."""
|
|
55
53
|
response = self.session.wialon_api.core_search_items(
|
|
56
54
|
**{
|
|
57
55
|
"spec": {
|
|
@@ -7,8 +7,8 @@ from terminusgps.wialon import constants
|
|
|
7
7
|
|
|
8
8
|
class WialonUser(WialonBase):
|
|
9
9
|
def create(self, **kwargs) -> int | None:
|
|
10
|
-
if not kwargs.get("
|
|
11
|
-
raise ValueError("'
|
|
10
|
+
if not kwargs.get("creator_id"):
|
|
11
|
+
raise ValueError("'creator_id' is required on creation.")
|
|
12
12
|
if not kwargs.get("name"):
|
|
13
13
|
raise ValueError("'name' is required on creation.")
|
|
14
14
|
if not kwargs.get("password"):
|
|
@@ -16,7 +16,7 @@ class WialonUser(WialonBase):
|
|
|
16
16
|
|
|
17
17
|
response = self.session.wialon_api.core_create_user(
|
|
18
18
|
**{
|
|
19
|
-
"creatorId": kwargs["
|
|
19
|
+
"creatorId": kwargs["creator_id"],
|
|
20
20
|
"name": kwargs["name"],
|
|
21
21
|
"password": kwargs["password"],
|
|
22
22
|
"dataFlags": flags.DATAFLAG_UNIT_BASE,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|