python-terminusgps 41.3.1__tar.gz → 42.0.1__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.
Files changed (71) hide show
  1. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/PKG-INFO +1 -1
  2. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/docs/source/conf.py +1 -1
  3. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/pyproject.toml +1 -1
  4. python_terminusgps-42.0.1/terminusgps/wialon/items/factory.py +88 -0
  5. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/terminusgps/wialon/items/retranslator.py +12 -9
  6. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/terminusgps/wialon/items/unit.py +10 -0
  7. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/uv.lock +1 -1
  8. python_terminusgps-41.3.1/terminusgps/wialon/items/factory.py +0 -113
  9. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/.gitignore +0 -0
  10. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/COPYING +0 -0
  11. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/README.md +0 -0
  12. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/docs/Makefile +0 -0
  13. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/docs/make.bat +0 -0
  14. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/docs/source/authorizenet/auth.rst +0 -0
  15. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/docs/source/authorizenet/constants.rst +0 -0
  16. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/docs/source/authorizenet/controllers.rst +0 -0
  17. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/docs/source/authorizenet/examples.rst +0 -0
  18. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/docs/source/authorizenet/index.rst +0 -0
  19. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/docs/source/authorizenet/profiles.rst +0 -0
  20. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/docs/source/authorizenet/subscriptions.rst +0 -0
  21. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/docs/source/authorizenet/utils.rst +0 -0
  22. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/docs/source/authorizenet/validators.rst +0 -0
  23. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/docs/source/django/forms.rst +0 -0
  24. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/docs/source/django/index.rst +0 -0
  25. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/docs/source/django/mixins.rst +0 -0
  26. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/docs/source/django/settings.rst +0 -0
  27. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/docs/source/django/validators.rst +0 -0
  28. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/docs/source/index.rst +0 -0
  29. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/docs/source/wialon/constants.rst +0 -0
  30. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/docs/source/wialon/errors.rst +0 -0
  31. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/docs/source/wialon/examples.rst +0 -0
  32. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/docs/source/wialon/flags.rst +0 -0
  33. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/docs/source/wialon/index.rst +0 -0
  34. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/docs/source/wialon/items.rst +0 -0
  35. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/docs/source/wialon/session.rst +0 -0
  36. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/docs/source/wialon/utils.rst +0 -0
  37. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/terminusgps/__init__.py +0 -0
  38. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/terminusgps/authorizenet/__init__.py +0 -0
  39. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/terminusgps/authorizenet/auth.py +0 -0
  40. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/terminusgps/authorizenet/constants.py +0 -0
  41. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/terminusgps/authorizenet/controllers.py +0 -0
  42. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/terminusgps/authorizenet/profiles/__init__.py +0 -0
  43. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/terminusgps/authorizenet/profiles/addresses.py +0 -0
  44. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/terminusgps/authorizenet/profiles/customers.py +0 -0
  45. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/terminusgps/authorizenet/profiles/payments.py +0 -0
  46. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/terminusgps/authorizenet/subscriptions.py +0 -0
  47. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/terminusgps/authorizenet/utils.py +0 -0
  48. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/terminusgps/authorizenet/validators.py +0 -0
  49. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/terminusgps/django/__init__.py +0 -0
  50. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/terminusgps/django/forms/__init__.py +0 -0
  51. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/terminusgps/django/forms/fields.py +0 -0
  52. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/terminusgps/django/forms/forms.py +0 -0
  53. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/terminusgps/django/forms/renderer.py +0 -0
  54. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/terminusgps/django/forms/widgets.py +0 -0
  55. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/terminusgps/django/mixins.py +0 -0
  56. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/terminusgps/django/settings.py +0 -0
  57. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/terminusgps/django/utils.py +0 -0
  58. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/terminusgps/django/validators.py +0 -0
  59. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/terminusgps/wialon/__init__.py +0 -0
  60. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/terminusgps/wialon/constants.py +0 -0
  61. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/terminusgps/wialon/flags.py +0 -0
  62. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/terminusgps/wialon/items/__init__.py +0 -0
  63. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/terminusgps/wialon/items/account.py +0 -0
  64. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/terminusgps/wialon/items/base.py +0 -0
  65. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/terminusgps/wialon/items/resource.py +0 -0
  66. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/terminusgps/wialon/items/route.py +0 -0
  67. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/terminusgps/wialon/items/unit_group.py +0 -0
  68. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/terminusgps/wialon/items/user.py +0 -0
  69. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/terminusgps/wialon/session.py +0 -0
  70. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/terminusgps/wialon/utils.py +0 -0
  71. {python_terminusgps-41.3.1 → python_terminusgps-42.0.1}/terminusgps/wialon/validators.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-terminusgps
3
- Version: 41.3.1
3
+ Version: 42.0.1
4
4
  Summary: Provides abstractions/utilities for working with Wialon API, Authorize.NET API, AWS API, and more.
5
5
  Project-URL: Documentation, https://docs.terminusgps.com
6
6
  Project-URL: Repository, https://github.com/terminusgps/python-terminusgps
@@ -18,7 +18,7 @@ django.setup()
18
18
  project = "python-terminusgps"
19
19
  copyright = "2025, Terminus GPS, LLC"
20
20
  author = "Terminus GPS, LLC"
21
- release = "41.3.1"
21
+ release = "42.0.1"
22
22
 
23
23
  # -- General configuration ---------------------------------------------------
24
24
  # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "python-terminusgps"
3
- version = "41.3.1"
3
+ version = "42.0.1"
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,88 @@
1
+ from typing import Literal, overload
2
+
3
+ from terminusgps.wialon.items.account import WialonAccount
4
+ from terminusgps.wialon.items.base import WialonObject
5
+ from terminusgps.wialon.items.resource import WialonResource
6
+ from terminusgps.wialon.items.retranslator import WialonRetranslator
7
+ from terminusgps.wialon.items.route import WialonRoute
8
+ from terminusgps.wialon.items.unit import WialonUnit
9
+ from terminusgps.wialon.items.unit_group import WialonUnitGroup
10
+ from terminusgps.wialon.items.user import WialonUser
11
+ from terminusgps.wialon.session import WialonSession
12
+
13
+ WIALON_ITEMSTYPE_MAP = {
14
+ "account": WialonAccount,
15
+ "avl_hw": None,
16
+ "avl_resource": WialonResource,
17
+ "avl_retranslator": WialonRetranslator,
18
+ "avl_route": WialonRoute,
19
+ "avl_unit": WialonUnit,
20
+ "avl_unit_group": WialonUnitGroup,
21
+ "user": WialonUser,
22
+ }
23
+
24
+
25
+ class WialonObjectFactory:
26
+ """Creates and retrieves Wialon objects from Wialon."""
27
+
28
+ def __init__(self, session: WialonSession) -> None:
29
+ # TODO: Add session refreshing
30
+ self.session = session
31
+
32
+ @overload
33
+ def create(self, items_type: Literal["user"], *args, **kwargs) -> WialonUser: ...
34
+
35
+ @overload
36
+ def create(
37
+ self, items_type: Literal["account"], *args, **kwargs
38
+ ) -> WialonAccount: ...
39
+
40
+ @overload
41
+ def create(
42
+ self, items_type: Literal["avl_resource"], *args, **kwargs
43
+ ) -> WialonResource: ...
44
+
45
+ @overload
46
+ def create(
47
+ self, items_type: Literal["avl_retranslator"], *args, **kwargs
48
+ ) -> WialonRetranslator: ...
49
+
50
+ @overload
51
+ def create(
52
+ self, items_type: Literal["avl_route"], *args, **kwargs
53
+ ) -> WialonRoute: ...
54
+
55
+ @overload
56
+ def create(
57
+ self, items_type: Literal["avl_unit"], *args, **kwargs
58
+ ) -> WialonUnit: ...
59
+
60
+ @overload
61
+ def create(
62
+ self, items_type: Literal["avl_unit_group"], *args, **kwargs
63
+ ) -> WialonUnitGroup: ...
64
+
65
+ def create(self, items_type: str, *args, **kwargs) -> WialonObject:
66
+ """Creates a Wialon object in Wialon and returns its Python equivalent."""
67
+ cls = self._get_wialon_cls(items_type)
68
+ if cls is None:
69
+ raise ValueError(f"Invalid Wialon items type: '{items_type}'.")
70
+ return self._create_wialon_obj(cls, *args, **kwargs)
71
+
72
+ def get(self, items_type: str, id: int | str) -> WialonObject:
73
+ """Retrieves a Wialon object from Wialon and returns its Python equivalent."""
74
+ cls = self._get_wialon_cls(items_type)
75
+ if cls is None:
76
+ raise ValueError(f"Invalid Wialon items type: '{items_type}'.")
77
+ return self._retrieve_wialon_obj(cls, id)
78
+
79
+ def _get_wialon_cls(self, items_type) -> WialonObject | None:
80
+ return WIALON_ITEMSTYPE_MAP.get(items_type)
81
+
82
+ def _create_wialon_obj(self, cls, *args, **kwargs) -> WialonObject:
83
+ obj = cls(session=self.session, id=None)
84
+ obj.create(*args, **kwargs)
85
+ return obj
86
+
87
+ def _retrieve_wialon_obj(self, cls, id) -> WialonObject:
88
+ return cls(session=self.session, id=int(id))
@@ -3,15 +3,18 @@ from typing import TypedDict
3
3
  from terminusgps.wialon import flags
4
4
  from terminusgps.wialon.items.base import WialonObject
5
5
 
6
-
7
- class WialonRetranslatorConfiguration(TypedDict):
8
- protocol: str
9
- server: str
10
- port: int
11
- auth: str
12
- ssl: int
13
- debug: int
14
- v6type: int
6
+ WialonRetranslatorConfiguration = TypedDict(
7
+ "WialonRetranslatorConfiguration",
8
+ {
9
+ "protocol": str,
10
+ "server": str,
11
+ "port": int,
12
+ "auth": str,
13
+ "ssl": int,
14
+ "debug": int,
15
+ "v6type": int,
16
+ },
17
+ )
15
18
 
16
19
 
17
20
  class WialonRetranslator(WialonObject):
@@ -132,3 +132,13 @@ class WialonUnit(WialonObject):
132
132
  if command_ids is not None
133
133
  else {"itemId": self.id}
134
134
  )
135
+
136
+ @requires_id
137
+ def get_imei(self) -> str:
138
+ return str(
139
+ self.session.wialon_api.core_search_item(
140
+ **{"id": self.id, "flags": flags.DataFlag.UNIT_ADVANCED_PROPERTIES}
141
+ )
142
+ .get("item", {})
143
+ .get("uid")
144
+ )
@@ -298,7 +298,7 @@ wheels = [
298
298
 
299
299
  [[package]]
300
300
  name = "python-terminusgps"
301
- version = "41.3.1"
301
+ version = "42.0.1"
302
302
  source = { editable = "." }
303
303
  dependencies = [
304
304
  { name = "authorizenet" },
@@ -1,113 +0,0 @@
1
- from terminusgps.wialon.items.account import WialonAccount
2
- from terminusgps.wialon.items.base import WialonObject
3
- from terminusgps.wialon.items.resource import WialonResource
4
- from terminusgps.wialon.items.retranslator import WialonRetranslator
5
- from terminusgps.wialon.items.route import WialonRoute
6
- from terminusgps.wialon.items.unit import WialonUnit
7
- from terminusgps.wialon.items.unit_group import WialonUnitGroup
8
- from terminusgps.wialon.items.user import WialonUser
9
- from terminusgps.wialon.session import WialonSession
10
-
11
- WIALON_ITEMSTYPE_MAP = {
12
- "account": WialonAccount,
13
- "avl_hw": None,
14
- "avl_resource": WialonResource,
15
- "avl_retranslator": WialonRetranslator,
16
- "avl_route": WialonRoute,
17
- "avl_unit": WialonUnit,
18
- "avl_unit_group": WialonUnitGroup,
19
- "user": WialonUser,
20
- }
21
-
22
-
23
- class WialonObjectFactory:
24
- """Creates and retrieves Wialon objects from Wialon."""
25
-
26
- def __init__(self, session: WialonSession) -> None:
27
- # TODO: Add session refreshing
28
- self.session = session
29
-
30
- def get(self, id: int | str, items_type: str) -> WialonObject:
31
- """
32
- Returns a Wialon object that already exists in Wialon by id.
33
-
34
- :param id: A Wialon object id.
35
- :type id: :py:obj:`int` | :py:obj:`str`
36
- :param items_type: A Wialon items type string.
37
- :type items_type: :py:obj:`str`
38
- :raises ValueError: If ``id`` wasn't a digit.
39
- :raises ValueError: If ``items_type`` was invalid.
40
- :returns: An existing Wialon object.
41
- :rtype: :py:obj:`WialonObject`
42
-
43
- Available items_type options:
44
-
45
- +-------------------------+---------------------------------------------------------------------+
46
- | key | class |
47
- +=========================+=====================================================================+
48
- | ``"account"`` | :py:obj:`~terminusgps.wialon.items.account.WialonAccount` |
49
- +-------------------------+---------------------------------------------------------------------+
50
- | ``"avl_resource"`` | :py:obj:`~terminusgps.wialon.items.resource.WialonResource` |
51
- +-------------------------+---------------------------------------------------------------------+
52
- | ``"avl_retranslator"`` | :py:obj:`~terminusgps.wialon.items.retranslator.WialonRetranslator` |
53
- +-------------------------+---------------------------------------------------------------------+
54
- | ``"avl_route"`` | :py:obj:`~terminusgps.wialon.items.route.WialonRoute` |
55
- +-------------------------+---------------------------------------------------------------------+
56
- | ``"avl_unit"`` | :py:obj:`~terminusgps.wialon.items.unit.WialonUnit` |
57
- +-------------------------+---------------------------------------------------------------------+
58
- | ``"avl_unit_group"`` | :py:obj:`~terminusgps.wialon.items.unit_group.WialonUnitGroup` |
59
- +-------------------------+---------------------------------------------------------------------+
60
- | ``"user"`` | :py:obj:`~terminusgps.wialon.items.user.WialonUser` |
61
- +-------------------------+---------------------------------------------------------------------+
62
-
63
- """
64
- if isinstance(id, str) and not id.isdigit():
65
- raise ValueError(f"'id' can only be digits, got '{id}'.")
66
- if items_type not in WIALON_ITEMSTYPE_MAP:
67
- raise ValueError(f"Invalid Wialon items type: '{items_type}'.")
68
- cls = WIALON_ITEMSTYPE_MAP.get(items_type)
69
- if cls is None:
70
- raise ValueError(f"Wialon items type '{items_type}' is not implemented.")
71
- return cls(session=self.session, id=int(id))
72
-
73
- def create(self, items_type: str, *args, **kwargs) -> WialonObject:
74
- """
75
- Returns a Wialon object after creating it in Wialon.
76
-
77
- :param items_type: A Wialon items type string.
78
- :type items_type: :py:obj:`str`
79
- :param args: Positional arguments passed to the object's :py:meth:`create` method.
80
- :param kwargs: Keyword arguments passed to the object's :py:meth:`create` method.
81
- :raises ValueError: If ``items_type`` was invalid.
82
- :returns: A newly created Wialon object.
83
- :rtype: :py:obj:`WialonObject`
84
-
85
- Available items_type options:
86
-
87
- +-------------------------+---------------------------------------------------------------------+
88
- | key | class |
89
- +=========================+=====================================================================+
90
- | ``"account"`` | :py:obj:`~terminusgps.wialon.items.account.WialonAccount` |
91
- +-------------------------+---------------------------------------------------------------------+
92
- | ``"avl_resource"`` | :py:obj:`~terminusgps.wialon.items.resource.WialonResource` |
93
- +-------------------------+---------------------------------------------------------------------+
94
- | ``"avl_retranslator"`` | :py:obj:`~terminusgps.wialon.items.retranslator.WialonRetranslator` |
95
- +-------------------------+---------------------------------------------------------------------+
96
- | ``"avl_route"`` | :py:obj:`~terminusgps.wialon.items.route.WialonRoute` |
97
- +-------------------------+---------------------------------------------------------------------+
98
- | ``"avl_unit"`` | :py:obj:`~terminusgps.wialon.items.unit.WialonUnit` |
99
- +-------------------------+---------------------------------------------------------------------+
100
- | ``"avl_unit_group"`` | :py:obj:`~terminusgps.wialon.items.unit_group.WialonUnitGroup` |
101
- +-------------------------+---------------------------------------------------------------------+
102
- | ``"user"`` | :py:obj:`~terminusgps.wialon.items.user.WialonUser` |
103
- +-------------------------+---------------------------------------------------------------------+
104
-
105
- """
106
- if items_type not in WIALON_ITEMSTYPE_MAP:
107
- raise ValueError(f"Invalid Wialon items type: '{items_type}'.")
108
- cls = WIALON_ITEMSTYPE_MAP.get(items_type)
109
- if cls is None:
110
- raise ValueError(f"Wialon items type '{items_type}' is not implemented.")
111
- obj = cls(session=self.session, id=None)
112
- obj.create(*args, **kwargs)
113
- return obj