python-terminusgps 36.4.1__py3-none-any.whl → 36.4.2__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: 36.4.1
3
+ Version: 36.4.2
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
@@ -38,7 +38,7 @@ terminusgps/wialon/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
38
38
  terminusgps/wialon/constants.py,sha256=05pLc_0S-x0tT87cQcxOmr8plesjOQxoXfUdjIHwI90,7732
39
39
  terminusgps/wialon/flags.py,sha256=M50EdhxQ8IMnJnU0mrHK7-h8Asc6tvNiTOOfd1dBW6A,12815
40
40
  terminusgps/wialon/session.py,sha256=BN8GBfYNIJcjvev9-qOam2Sbkf7EyCoQXTudRrmA3vc,10533
41
- terminusgps/wialon/utils.py,sha256=SwpcxLPBLy0u3AT84G-Co4wxmhRrPFyW3jo_9O6ICvk,11008
41
+ terminusgps/wialon/utils.py,sha256=iGOY8v7cNaSoA9Mo17d1bKAQMBtcotGq3FEQrghgvCo,11222
42
42
  terminusgps/wialon/validators.py,sha256=j5vrtcfClAzRdRkWTvRRAmrne1t0R6cKkmYdE7fAkSs,4247
43
43
  terminusgps/wialon/items/__init__.py,sha256=3BVthghekMvhMQSzQgBMlD_phxmKSmp3Zvmo-z0O8Bs,211
44
44
  terminusgps/wialon/items/base.py,sha256=ZhndkcVWTOjsEKe5L0NQsLvvXj2Fs0Xv-qBjjm1Xmpk,10421
@@ -52,7 +52,7 @@ terminusgps/wialon/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
52
52
  terminusgps/wialon/tests/test_items.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
53
53
  terminusgps/wialon/tests/test_session.py,sha256=9mBlYchMo9NeqRIZsmxYzrM1zBHorqu4ooxqSNppLpI,1336
54
54
  terminusgps/wialon/tests/test_utils.py,sha256=SK4PxJQGECFnzx_EQeRAQfsQ5_3FLaVcis2W9u_ibuI,1730
55
- python_terminusgps-36.4.1.dist-info/METADATA,sha256=MoYb6Vwu-FQT8KvAoeNbClAfe1JI4MM5HwFTdfOLPIY,1616
56
- python_terminusgps-36.4.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
57
- python_terminusgps-36.4.1.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
58
- python_terminusgps-36.4.1.dist-info/RECORD,,
55
+ python_terminusgps-36.4.2.dist-info/METADATA,sha256=moU-r9iotwr4Sb98T_uEnJa6_VK9DYtkoIL7FCT7fQM,1616
56
+ python_terminusgps-36.4.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
57
+ python_terminusgps-36.4.2.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
58
+ python_terminusgps-36.4.2.dist-info/RECORD,,
@@ -204,6 +204,7 @@ def get_unit_by_imei(imei: str, session: WialonSession) -> WialonUnit | None:
204
204
  :param session: A valid Wialon API session.
205
205
  :type session: :py:obj:`~terminusgps.wialon.session.WialonSession`
206
206
  :raises ValueError: If ``imei`` contains non-digit characters.
207
+ :raises ValueError: If ``imei`` points to multiple Wialon units.
207
208
  :raises WialonError: If something goes wrong during a Wialon API call.
208
209
  :returns: A Wialon object id, if it was found.
209
210
  :rtype: :py:obj:`str` | :py:obj:`None`
@@ -217,19 +218,21 @@ def get_unit_by_imei(imei: str, session: WialonSession) -> WialonUnit | None:
217
218
  "spec": {
218
219
  "itemsType": "avl_unit",
219
220
  "propName": "sys_unique_id",
220
- "propValueMask": f"*{imei}*",
221
+ "propValueMask": imei,
221
222
  "sortType": "sys_unique_id",
222
223
  "propType": "property",
223
224
  "or_logic": 0,
224
225
  },
225
226
  "force": 0,
226
- "flags": flags.DataFlag.UNIT_BASE.value,
227
+ "flags": flags.DataFlag.UNIT_BASE,
227
228
  "from": 0,
228
229
  "to": 0,
229
230
  }
230
231
  )
231
232
 
232
- if results and results.get("totalItemsCount", 0) == 1:
233
+ if results is not None and results.get("totalItemsCount", 0) != 1:
234
+ raise ValueError(f"Multiple units found with IMEI #: '{imei}'.")
235
+ elif results is not None and results.get("totalItemsCount", 0) == 1:
233
236
  return WialonUnit(id=results["items"][0].get("id"), session=session)
234
237
 
235
238