python-terminusgps 42.0.2__tar.gz → 42.2.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.

Files changed (70) hide show
  1. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/PKG-INFO +1 -1
  2. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/docs/source/conf.py +1 -1
  3. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/pyproject.toml +1 -1
  4. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/terminusgps/wialon/items/resource.py +8 -0
  5. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/terminusgps/wialon/utils.py +55 -35
  6. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/uv.lock +1 -1
  7. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/.gitignore +0 -0
  8. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/COPYING +0 -0
  9. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/README.md +0 -0
  10. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/docs/Makefile +0 -0
  11. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/docs/make.bat +0 -0
  12. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/docs/source/authorizenet/auth.rst +0 -0
  13. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/docs/source/authorizenet/constants.rst +0 -0
  14. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/docs/source/authorizenet/controllers.rst +0 -0
  15. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/docs/source/authorizenet/examples.rst +0 -0
  16. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/docs/source/authorizenet/index.rst +0 -0
  17. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/docs/source/authorizenet/profiles.rst +0 -0
  18. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/docs/source/authorizenet/subscriptions.rst +0 -0
  19. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/docs/source/authorizenet/utils.rst +0 -0
  20. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/docs/source/authorizenet/validators.rst +0 -0
  21. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/docs/source/django/forms.rst +0 -0
  22. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/docs/source/django/index.rst +0 -0
  23. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/docs/source/django/mixins.rst +0 -0
  24. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/docs/source/django/settings.rst +0 -0
  25. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/docs/source/django/validators.rst +0 -0
  26. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/docs/source/index.rst +0 -0
  27. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/docs/source/wialon/constants.rst +0 -0
  28. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/docs/source/wialon/errors.rst +0 -0
  29. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/docs/source/wialon/examples.rst +0 -0
  30. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/docs/source/wialon/flags.rst +0 -0
  31. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/docs/source/wialon/index.rst +0 -0
  32. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/docs/source/wialon/items.rst +0 -0
  33. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/docs/source/wialon/session.rst +0 -0
  34. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/docs/source/wialon/utils.rst +0 -0
  35. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/terminusgps/__init__.py +0 -0
  36. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/terminusgps/authorizenet/__init__.py +0 -0
  37. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/terminusgps/authorizenet/auth.py +0 -0
  38. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/terminusgps/authorizenet/constants.py +0 -0
  39. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/terminusgps/authorizenet/controllers.py +0 -0
  40. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/terminusgps/authorizenet/profiles/__init__.py +0 -0
  41. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/terminusgps/authorizenet/profiles/addresses.py +0 -0
  42. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/terminusgps/authorizenet/profiles/customers.py +0 -0
  43. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/terminusgps/authorizenet/profiles/payments.py +0 -0
  44. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/terminusgps/authorizenet/subscriptions.py +0 -0
  45. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/terminusgps/authorizenet/utils.py +0 -0
  46. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/terminusgps/authorizenet/validators.py +0 -0
  47. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/terminusgps/django/__init__.py +0 -0
  48. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/terminusgps/django/forms/__init__.py +0 -0
  49. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/terminusgps/django/forms/fields.py +0 -0
  50. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/terminusgps/django/forms/forms.py +0 -0
  51. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/terminusgps/django/forms/renderer.py +0 -0
  52. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/terminusgps/django/forms/widgets.py +0 -0
  53. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/terminusgps/django/mixins.py +0 -0
  54. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/terminusgps/django/settings.py +0 -0
  55. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/terminusgps/django/utils.py +0 -0
  56. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/terminusgps/django/validators.py +0 -0
  57. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/terminusgps/wialon/__init__.py +0 -0
  58. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/terminusgps/wialon/constants.py +0 -0
  59. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/terminusgps/wialon/flags.py +0 -0
  60. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/terminusgps/wialon/items/__init__.py +0 -0
  61. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/terminusgps/wialon/items/account.py +0 -0
  62. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/terminusgps/wialon/items/base.py +0 -0
  63. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/terminusgps/wialon/items/factory.py +0 -0
  64. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/terminusgps/wialon/items/retranslator.py +0 -0
  65. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/terminusgps/wialon/items/route.py +0 -0
  66. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/terminusgps/wialon/items/unit.py +0 -0
  67. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/terminusgps/wialon/items/unit_group.py +0 -0
  68. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/terminusgps/wialon/items/user.py +0 -0
  69. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/terminusgps/wialon/session.py +0 -0
  70. {python_terminusgps-42.0.2 → python_terminusgps-42.2.0}/terminusgps/wialon/validators.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-terminusgps
3
- Version: 42.0.2
3
+ Version: 42.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://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 = "42.0.2"
21
+ release = "42.2.0"
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 = "42.0.2"
3
+ version = "42.2.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" } ]
@@ -102,3 +102,11 @@ class WialonResource(WialonObject):
102
102
  "timeTo": stop.timestamp(),
103
103
  }
104
104
  )
105
+
106
+ @requires_id
107
+ def get_creator_id(self) -> str:
108
+ return str(
109
+ self.session.wialon_api.core_search_item(
110
+ **{"id": self.id, "flags": flags.DataFlag.RESOURCE_BILLING_PROPERTIES}
111
+ ).get("crt")
112
+ )
@@ -3,6 +3,7 @@ import string
3
3
  import typing
4
4
 
5
5
  from terminusgps.wialon import flags
6
+ from terminusgps.wialon.items import WialonObjectFactory
6
7
  from terminusgps.wialon.items.unit import WialonUnit
7
8
  from terminusgps.wialon.items.user import WialonUser
8
9
  from terminusgps.wialon.session import WialonSession
@@ -31,16 +32,16 @@ def get_hw_types(session: WialonSession) -> list[dict[str, str | int]]:
31
32
  return session.wialon_api.core_get_hw_types()
32
33
 
33
34
 
34
- def get_user_by_name(name: str, session: WialonSession) -> WialonUser | None:
35
+ def get_user_by_name(name: str, session: WialonSession) -> WialonUser:
35
36
  """
36
- Returns a Wialon user by name, if it exists.
37
+ Returns a Wialon user by name.
37
38
 
38
39
  :param name: A Wialon user name.
39
40
  :type name: :py:obj:`str`
40
41
  :param session: A valid Wialon API session.
41
42
  :type session: :py:obj:`~terminusgps.wialon.session.WialonSession`
42
- :returns: A Wialon unit, if any.
43
- :rtype: :py:obj:`~terminusgps.wialon.items.unit.WialonUnit` | :py:obj:`None`
43
+ :returns: A Wialon user.
44
+ :rtype: :py:obj:`~terminusgps.wialon.items.user.WialonUser` | :py:obj:`None`
44
45
 
45
46
  """
46
47
  response = session.wialon_api.core_search_items(
@@ -58,9 +59,14 @@ def get_user_by_name(name: str, session: WialonSession) -> WialonUser | None:
58
59
  "to": 0,
59
60
  }
60
61
  )
61
- if int(response.get("totalItemsCount")) == 1:
62
- if user_id := int(response.get("items")[0].get("id")):
63
- return WialonUser(session, user_id)
62
+ num_items: int = int(response.get("totalItemsCount"))
63
+ if num_items > 1:
64
+ raise ValueError(f"Multiple users returned for '{name}'.")
65
+ elif num_items <= 0:
66
+ raise ValueError(f"Couldn't find a Wialon user named '{name}'.")
67
+
68
+ factory = WialonObjectFactory(session)
69
+ return factory.get("user", id=int(response.get("items")[0].get("id")))
64
70
 
65
71
 
66
72
  def get_carrier_names(session: WialonSession) -> list[str]:
@@ -77,13 +83,13 @@ def get_carrier_names(session: WialonSession) -> list[str]:
77
83
  **{
78
84
  "spec": {
79
85
  "itemsType": "avl_unit",
80
- "propName": "rel_adminfield_name,rel_adminfield_value",
86
+ "propName": "admin_fields,rel_adminfield_value",
81
87
  "propValueMask": "carrier,*",
82
- "sortType": "sys_id,sys_id",
83
- "propType": "property",
88
+ "sortType": "admin_fields,admin_fields",
89
+ "propType": "propitemname",
84
90
  },
85
91
  "force": 0,
86
- "flags": flags.DataFlag.UNIT_BASE + flags.DataFlag.UNIT_ADMIN_FIELDS,
92
+ "flags": flags.DataFlag.UNIT_BASE | flags.DataFlag.UNIT_ADMIN_FIELDS,
87
93
  "from": 0,
88
94
  "to": 0,
89
95
  }
@@ -97,9 +103,7 @@ def get_carrier_names(session: WialonSession) -> list[str]:
97
103
  return sorted(list(frozenset(carrier_names)))
98
104
 
99
105
 
100
- def get_units_by_carrier(
101
- carrier_name: str, session: WialonSession
102
- ) -> list[WialonUnit] | None:
106
+ def get_units_by_carrier(carrier_name: str, session: WialonSession) -> list[WialonUnit]:
103
107
  """
104
108
  Returns a list of all units by telecommunications carrier company name.
105
109
 
@@ -115,22 +119,27 @@ def get_units_by_carrier(
115
119
  **{
116
120
  "spec": {
117
121
  "itemsType": "avl_unit",
118
- "propName": "rel_adminfield_name",
119
- "propValueMask": f"carrier:{carrier_name}",
120
- "sortType": "rel_adminfield_name",
121
- "propType": "property",
122
+ "propName": "admin_fields,rel_adminfield_value",
123
+ "propValueMask": f"carrier,{carrier_name}",
124
+ "sortType": "admin_fields,admin_fields",
125
+ "propType": "propitemname",
122
126
  },
123
127
  "force": 0,
124
- "flags": flags.DataFlag.UNIT_BASE,
128
+ "flags": flags.DataFlag.UNIT_BASE | flags.DataFlag.UNIT_ADMIN_FIELDS,
125
129
  "from": 0,
126
130
  "to": 0,
127
131
  }
128
132
  )
129
- if units := response.get("items", []):
130
- return [WialonUnit(session=session, id=int(unit.get("id"))) for unit in units]
133
+ num_items: int = int(response.get("totalItemsCount"))
134
+ if num_items <= 0:
135
+ raise ValueError(f"Couldn't find any units by carrier '{carrier_name}'.")
136
+
137
+ factory = WialonObjectFactory(session)
138
+ unit_ids = [int(unit.get("id")) for unit in response.get("items")]
139
+ return [factory.get("avl_unit", id) for id in unit_ids]
131
140
 
132
141
 
133
- def get_unit_by_iccid(iccid: str, session: WialonSession) -> WialonUnit | None:
142
+ def get_unit_by_iccid(iccid: str, session: WialonSession) -> WialonUnit:
134
143
  """
135
144
  Returns a unit by iccid (SIM card #).
136
145
 
@@ -138,28 +147,34 @@ def get_unit_by_iccid(iccid: str, session: WialonSession) -> WialonUnit | None:
138
147
  :type iccid: :py:obj:`str`
139
148
  :param session: A valid Wialon API session.
140
149
  :type session: :py:obj:`~terminusgps.wialon.session.WialonSession`
141
- :returns: The unit, if it was found.
142
- :rtype: :py:obj:`~terminusgps.wialon.items.WialonUnit` | :py:obj:`None`
150
+ :returns: The Wialon unit.
151
+ :rtype: :py:obj:`~terminusgps.wialon.items.WialonUnit`
143
152
 
144
153
  """
145
154
  response = session.wialon_api.core_search_items(
146
155
  **{
147
156
  "spec": {
148
157
  "itemsType": "avl_unit",
149
- "propName": "rel_adminfield_name",
150
- "propValueMask": f"iccid:{iccid}",
151
- "sortType": "rel_adminfield_name",
152
- "propType": "property",
158
+ "propName": "admin_fields,rel_adminfield_value",
159
+ "propValueMask": f"iccid,{iccid}",
160
+ "sortType": "admin_fields,admin_fields",
161
+ "propType": "propitemname",
153
162
  },
154
163
  "force": 0,
155
- "flags": flags.DataFlag.UNIT_BASE,
164
+ "flags": flags.DataFlag.UNIT_BASE | flags.DataFlag.UNIT_ADMIN_FIELDS,
156
165
  "from": 0,
157
166
  "to": 0,
158
167
  }
159
168
  )
160
- if int(response.get("totalItemsCount", 0)) == 1:
161
- if unit_id := int(response.get("items")[0].get("id")):
162
- return WialonUnit(session, unit_id)
169
+
170
+ num_items: int = int(response.get("totalItemsCount"))
171
+ if num_items > 1:
172
+ raise ValueError(f"Multiple units returned for '{iccid}'.")
173
+ elif num_items <= 0:
174
+ raise ValueError(f"Couldn't find a Wialon unit with iccid '{iccid}'.")
175
+
176
+ factory = WialonObjectFactory(session)
177
+ return factory.get("avl_unit", id=int(response.get("items")[0].get("id")))
163
178
 
164
179
 
165
180
  def get_unit_by_imei(imei: int | str, session: WialonSession) -> WialonUnit | None:
@@ -193,9 +208,14 @@ def get_unit_by_imei(imei: int | str, session: WialonSession) -> WialonUnit | No
193
208
  "to": 0,
194
209
  }
195
210
  )
196
- if int(response.get("totalItemsCount", 0)) == 1:
197
- if unit_id := response.get("items")[0].get("id"):
198
- return WialonUnit(session, unit_id)
211
+ num_items: int = int(response.get("totalItemsCount"))
212
+ if num_items > 1:
213
+ raise ValueError(f"Multiple units returned for IMEI #: '{imei}'.")
214
+ elif num_items <= 0:
215
+ raise ValueError(f"Couldn't find a Wialon unit with IMEI #: '{imei}'.")
216
+
217
+ factory = WialonObjectFactory(session)
218
+ return factory.get("avl_unit", id=int(response.get("items")[0].get("id")))
199
219
 
200
220
 
201
221
  def get_vin_info(vin_number: str, session: WialonSession) -> dict[str, typing.Any]:
@@ -298,7 +298,7 @@ wheels = [
298
298
 
299
299
  [[package]]
300
300
  name = "python-terminusgps"
301
- version = "42.0.2"
301
+ version = "42.2.0"
302
302
  source = { editable = "." }
303
303
  dependencies = [
304
304
  { name = "authorizenet" },