python-terminusgps 24.1.0__py3-none-any.whl → 24.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-terminusgps
3
- Version: 24.1.0
3
+ Version: 24.2.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
@@ -27,10 +27,10 @@ terminusgps/wialon/items/base.py,sha256=EAtzlnCvB7WTu3iX1bV1-S9TvwXc-Eez7e0X4TMi
27
27
  terminusgps/wialon/items/resource.py,sha256=qmQKEakJa9LH5YkI9-iBDA0hsotc5ctcwdb7kZuXdfQ,14549
28
28
  terminusgps/wialon/items/retranslator.py,sha256=8q9EDc92w92MElnHIeEzH3Ra4kiPXrx4t9V5nPDZuRU,3728
29
29
  terminusgps/wialon/items/route.py,sha256=PTJx1gmT_PGz7nlSSUS2VzjYD-aAuvkEOIdIFneUSSQ,1148
30
- terminusgps/wialon/items/unit.py,sha256=-jQL5Alvz77FZWteYNM9VNX15jtCufI-DWRRj3hRsgA,8539
31
- terminusgps/wialon/items/unit_group.py,sha256=vGVJMBY1BrKK0tP-C1DCIz4Bh6P-HKRnKY1g8g95UIs,5031
30
+ terminusgps/wialon/items/unit.py,sha256=K0kmzFEInR3dAQVtMUA6M7KNy7HlD5IKl7f7YElr2sQ,9116
31
+ terminusgps/wialon/items/unit_group.py,sha256=Stp-WfCGbOqcnxV6FU1AKtV7KIxIwCHa0NwhNJfgRoM,5032
32
32
  terminusgps/wialon/items/user.py,sha256=INwAibQVmjNNelepQXMfDevgJqMvIjHHgEjAMLRvhB0,7082
33
- python_terminusgps-24.1.0.dist-info/METADATA,sha256=s6KcarRL1pMhfGFwc2zK8Rhghm0Mah1N8kU5xViYnIU,946
34
- python_terminusgps-24.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
35
- python_terminusgps-24.1.0.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
36
- python_terminusgps-24.1.0.dist-info/RECORD,,
33
+ python_terminusgps-24.2.0.dist-info/METADATA,sha256=bbVaXq63-hNzcN6anqXZROwwpiLiQCVGaysMjctFxRY,946
34
+ python_terminusgps-24.2.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
35
+ python_terminusgps-24.2.0.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
36
+ python_terminusgps-24.2.0.dist-info/RECORD,,
@@ -17,7 +17,9 @@ class WialonUnit(WialonBase):
17
17
  :type name: :py:obj:`str`
18
18
  :param hw_type_id: A Wialon hardware type ID.
19
19
  :type hw_type_id: :py:obj:`str` | :py:obj:`int`
20
- :returns: The Wialon id for the new unit.
20
+ :raises ValueError: If ``creator_id`` is a :py:obj:`str` but not a digit.
21
+ :raises ValueError: If ``hw_type_id`` is a :py:obj:`str` but not a digit.
22
+ :returns: An id for the new unit.
21
23
  :rtype: :py:obj:`int` | :py:obj:`None`
22
24
 
23
25
  """
@@ -55,23 +57,36 @@ class WialonUnit(WialonBase):
55
57
  **{"id": self.id, "flags": flags.DATAFLAG_UNIT_POSITION}
56
58
  )
57
59
 
60
+ @property
61
+ def exists(self) -> bool:
62
+ """Whether or not the unit exists in Wialon."""
63
+ return bool(
64
+ self.session.wialon_api.core_search_item(
65
+ **{"id": self.id, "flags": flags.DATAFLAG_UNIT_BASE}
66
+ ).get("item", False)
67
+ )
68
+
58
69
  @property
59
70
  def available_commands(self) -> dict:
71
+ """Assigned commands to the unit."""
60
72
  return self.session.wialon_api.core_get_hw_cmds(
61
73
  **{"deviceTypeId": 0, "unitId": self.id}
62
74
  )
63
75
 
64
76
  @property
65
77
  def image_uri(self) -> str:
78
+ """An image URI for the unit."""
66
79
  return self._image_uri
67
80
 
68
81
  @property
69
82
  def imei_number(self) -> int | None:
83
+ """The unit's IMEI number."""
70
84
  if self._imei_number:
71
85
  return int(self._imei_number)
72
86
 
73
87
  @property
74
88
  def active(self) -> bool:
89
+ """Whether or not the unit is active."""
75
90
  if self._active:
76
91
  return bool(self._active)
77
92
  return False
@@ -85,7 +100,7 @@ class WialonUnit(WialonBase):
85
100
  param: dict | None = None,
86
101
  ) -> None:
87
102
  """
88
- Executes a command on this Wialon unit.
103
+ Executes a command on the unit.
89
104
 
90
105
  :param name: A Wialon command name.
91
106
  :type name: :py:obj:`str`
@@ -115,7 +130,7 @@ class WialonUnit(WialonBase):
115
130
 
116
131
  def set_access_password(self, password: str) -> None:
117
132
  """
118
- Sets a new access password for this Wialon unit.
133
+ Sets a new access password for the unit.
119
134
 
120
135
  :param password: A new access password.
121
136
  :type name: :py:obj:`str`
@@ -131,7 +146,7 @@ class WialonUnit(WialonBase):
131
146
 
132
147
  def activate(self) -> None:
133
148
  """
134
- Activates this Wialon unit.
149
+ Activates the unit.
135
150
 
136
151
  :raises WialonError: If something goes wrong with Wialon.
137
152
  :returns: Nothing.
@@ -145,7 +160,7 @@ class WialonUnit(WialonBase):
145
160
 
146
161
  def deactivate(self) -> None:
147
162
  """
148
- Deactivates this Wialon unit.
163
+ Deactivates the unit.
149
164
 
150
165
  :raises WialonError: If something goes wrong with Wialon.
151
166
  :returns: Nothing.
@@ -159,7 +174,7 @@ class WialonUnit(WialonBase):
159
174
 
160
175
  def assign_phone(self, phone: str) -> None:
161
176
  """
162
- Assigns a phone number to this Wialon unit.
177
+ Assigns a phone number to the unit.
163
178
 
164
179
  :param phone: A phone number beginning with a country code.
165
180
  :type phone: :py:obj:`str`
@@ -120,10 +120,11 @@ class WialonUnitGroup(WialonBase):
120
120
  def main() -> None:
121
121
  import logging
122
122
 
123
- from django.utils import timezone
124
123
  from django.conf import settings
125
- from terminusgps.wialon.session import WialonSession
124
+ from django.utils import timezone
125
+
126
126
  from terminusgps.wialon.items import WialonUnit
127
+ from terminusgps.wialon.session import WialonSession
127
128
  from terminusgps.wialon.utils import get_hw_type_id
128
129
 
129
130
  timestamp = f"{timezone.now():%Y_%m_%d_%H:%M:%S}"