python-terminusgps 20.7.0__py3-none-any.whl → 21.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.
Potentially problematic release.
This version of python-terminusgps might be problematic. Click here for more details.
- {python_terminusgps-20.7.0.dist-info → python_terminusgps-21.2.0.dist-info}/METADATA +1 -1
- {python_terminusgps-20.7.0.dist-info → python_terminusgps-21.2.0.dist-info}/RECORD +7 -7
- terminusgps/wialon/items/resource.py +52 -21
- terminusgps/wialon/items/unit.py +5 -7
- terminusgps/wialon/utils.py +20 -2
- {python_terminusgps-20.7.0.dist-info → python_terminusgps-21.2.0.dist-info}/WHEEL +0 -0
- {python_terminusgps-20.7.0.dist-info → python_terminusgps-21.2.0.dist-info}/licenses/COPYING +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-terminusgps
|
|
3
|
-
Version:
|
|
3
|
+
Version: 21.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
|
|
@@ -18,16 +18,16 @@ terminusgps/wialon/constants.py,sha256=n1ux68oWYWnzeZdN811Iw_Lk78KBM0YMJMoonn67u
|
|
|
18
18
|
terminusgps/wialon/flags.py,sha256=_NIL3mrEGhvI5YISVjimjYtUatdgOqhZPJX368MtKSU,13959
|
|
19
19
|
terminusgps/wialon/logger.py,sha256=nUBsaLMaffSaAHGHAM6mFXDzix9hbNecVtA3INVtii8,968
|
|
20
20
|
terminusgps/wialon/session.py,sha256=6xg65LZz6cebWclTQp1KRLvPss0aM-bWhAmmwiDOlMg,10267
|
|
21
|
-
terminusgps/wialon/utils.py,sha256=
|
|
21
|
+
terminusgps/wialon/utils.py,sha256=HUuBgkqJzzsFHGKPgf_YAE0e5Oui8xdaYtb9fv_ibOc,6344
|
|
22
22
|
terminusgps/wialon/items/__init__.py,sha256=3BVthghekMvhMQSzQgBMlD_phxmKSmp3Zvmo-z0O8Bs,211
|
|
23
23
|
terminusgps/wialon/items/base.py,sha256=EAtzlnCvB7WTu3iX1bV1-S9TvwXc-Eez7e0X4TMiK9U,6943
|
|
24
|
-
terminusgps/wialon/items/resource.py,sha256=
|
|
24
|
+
terminusgps/wialon/items/resource.py,sha256=J2HRSbGwGcfTcaurMI0oms5XcmUjf887GJVaXLfyA-o,14551
|
|
25
25
|
terminusgps/wialon/items/retranslator.py,sha256=8q9EDc92w92MElnHIeEzH3Ra4kiPXrx4t9V5nPDZuRU,3728
|
|
26
26
|
terminusgps/wialon/items/route.py,sha256=PTJx1gmT_PGz7nlSSUS2VzjYD-aAuvkEOIdIFneUSSQ,1148
|
|
27
|
-
terminusgps/wialon/items/unit.py,sha256=
|
|
27
|
+
terminusgps/wialon/items/unit.py,sha256=oNqLdblY6uWd08FCInSix9gzDYk-O1YdgbkENZ-1vjs,8541
|
|
28
28
|
terminusgps/wialon/items/unit_group.py,sha256=vGVJMBY1BrKK0tP-C1DCIz4Bh6P-HKRnKY1g8g95UIs,5031
|
|
29
29
|
terminusgps/wialon/items/user.py,sha256=INwAibQVmjNNelepQXMfDevgJqMvIjHHgEjAMLRvhB0,7082
|
|
30
|
-
python_terminusgps-
|
|
31
|
-
python_terminusgps-
|
|
32
|
-
python_terminusgps-
|
|
33
|
-
python_terminusgps-
|
|
30
|
+
python_terminusgps-21.2.0.dist-info/METADATA,sha256=eSyk_vdKqPA1np55nwimM-J2Wnq8c9j0pZdlK5XgQs8,912
|
|
31
|
+
python_terminusgps-21.2.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
32
|
+
python_terminusgps-21.2.0.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
33
|
+
python_terminusgps-21.2.0.dist-info/RECORD,,
|
|
@@ -287,8 +287,6 @@ class WialonResource(WialonBase):
|
|
|
287
287
|
desc: str = "",
|
|
288
288
|
phone: str = "",
|
|
289
289
|
mobile_auth_code: str = "",
|
|
290
|
-
image_checksum: str = "",
|
|
291
|
-
image_ratio: str = "",
|
|
292
290
|
custom_fields: dict[str, str] | None = None,
|
|
293
291
|
) -> None:
|
|
294
292
|
"""
|
|
@@ -304,10 +302,6 @@ class WialonResource(WialonBase):
|
|
|
304
302
|
:type phone: :py:obj:`str`
|
|
305
303
|
:param mobile_auth_code: Authentication code for Wialon mobile app.
|
|
306
304
|
:type mobile_auth_code: :py:obj:`str`
|
|
307
|
-
:param image_checksum: Checksum for driver image.
|
|
308
|
-
:type image_checksum: :py:obj:`str`
|
|
309
|
-
:param image_ratio: Driver image aspect ratio.
|
|
310
|
-
:type image_ratio: :py:obj:`float` | :py:obj:`None`
|
|
311
305
|
:param custom_fields: Additional custom fields to add to the driver.
|
|
312
306
|
:type custom_fields: :py:obj:`dict` | :py:obj:`None`
|
|
313
307
|
:raises WialonError: If something goes wrong calling the Wialon API.
|
|
@@ -331,17 +325,13 @@ class WialonResource(WialonBase):
|
|
|
331
325
|
params.update({"p": quote_plus(phone)})
|
|
332
326
|
if custom_fields:
|
|
333
327
|
params.update({"jp": custom_fields})
|
|
334
|
-
|
|
335
|
-
print(f"{response = }")
|
|
328
|
+
self.session.wialon_api.resource_update_driver(**params)
|
|
336
329
|
|
|
337
330
|
def create_passenger(
|
|
338
331
|
self,
|
|
339
332
|
name: str,
|
|
340
333
|
code: str,
|
|
341
334
|
phone: str = "",
|
|
342
|
-
timezone: int | None = None,
|
|
343
|
-
image_checksum: str = "",
|
|
344
|
-
image_ratio: float | None = None,
|
|
345
335
|
custom_fields: dict[str, str] | None = None,
|
|
346
336
|
) -> None:
|
|
347
337
|
"""
|
|
@@ -353,12 +343,6 @@ class WialonResource(WialonBase):
|
|
|
353
343
|
:type code: :py:obj:`str`
|
|
354
344
|
:param phone: A phone number beginning in a country code. No spaces.
|
|
355
345
|
:type phone: :py:obj:`str`
|
|
356
|
-
:param timezone: A timezone integer.
|
|
357
|
-
:type timezone: :py:obj:`int` | :py:obj:`None`
|
|
358
|
-
:param image_checksum: Checksum for passenger image.
|
|
359
|
-
:type image_checksum: :py:obj:`str`
|
|
360
|
-
:param image_ratio: Passenger image aspect ratio.
|
|
361
|
-
:type image_ratio: :py:obj:`float` | :py:obj:`None`
|
|
362
346
|
:param custom_fields: Additional custom fields to add to the passenger.
|
|
363
347
|
:type custom_fields: :py:obj:`dict` | :py:obj:`None`
|
|
364
348
|
:raises WialonError: If something goes wrong calling the Wialon API.
|
|
@@ -371,14 +355,61 @@ class WialonResource(WialonBase):
|
|
|
371
355
|
"id": 0,
|
|
372
356
|
"callMode": "create",
|
|
373
357
|
"c": code,
|
|
374
|
-
"ck": image_checksum,
|
|
375
|
-
"r": image_ratio,
|
|
376
358
|
"n": name,
|
|
377
359
|
}
|
|
378
360
|
if phone:
|
|
379
361
|
params.update({"p": quote_plus(phone)})
|
|
380
|
-
if timezone:
|
|
381
|
-
params.update({"tz": timezone})
|
|
382
362
|
if custom_fields:
|
|
383
363
|
params.update({"jp": custom_fields})
|
|
384
364
|
self.session.wialon_api.resource_update_tag(**params)
|
|
365
|
+
|
|
366
|
+
def update_attachable_drivers(self, units: list[str | int]) -> None:
|
|
367
|
+
"""Updates the pool of units for the resource to attach drivers to the new unit list."""
|
|
368
|
+
self.session.wialon_api.update_driver_units(
|
|
369
|
+
**{"itemId": self.id, "units": units}
|
|
370
|
+
)
|
|
371
|
+
|
|
372
|
+
def update_attachable_passengers(self, units: list[str | int]) -> None:
|
|
373
|
+
"""Updates the pool of units for the resource to attach passengers to the new unit list."""
|
|
374
|
+
self.session.wialon_api.update_tag_units(**{"itemId": self.id, "units": units})
|
|
375
|
+
|
|
376
|
+
def create_trailer(
|
|
377
|
+
self,
|
|
378
|
+
name: str,
|
|
379
|
+
code: str,
|
|
380
|
+
desc: str = "",
|
|
381
|
+
phone: str = "",
|
|
382
|
+
custom_fields: dict[str, str] | None = None,
|
|
383
|
+
) -> None:
|
|
384
|
+
"""
|
|
385
|
+
Creates a trailer for the resource.
|
|
386
|
+
|
|
387
|
+
:param name: A name for the new trailer.
|
|
388
|
+
:type name: :py:obj:`str`
|
|
389
|
+
:param code: A unique code for the new trailer.
|
|
390
|
+
:type code: :py:obj:`str`
|
|
391
|
+
:param desc: A description for the trailer.
|
|
392
|
+
:type desc: :py:obj:`str`
|
|
393
|
+
:param phone: A phone number beginning in a country code. No spaces.
|
|
394
|
+
:type phone: :py:obj:`str`
|
|
395
|
+
:param custom_fields: Additional custom fields to add to the trailer.
|
|
396
|
+
:type custom_fields: :py:obj:`dict` | :py:obj:`None`
|
|
397
|
+
:raises WialonError: If something goes wrong calling the Wialon API.
|
|
398
|
+
:returns: Nothing.
|
|
399
|
+
:rtype: :py:obj:`None`
|
|
400
|
+
|
|
401
|
+
"""
|
|
402
|
+
params = {
|
|
403
|
+
"itemId": self.id,
|
|
404
|
+
"id": 0,
|
|
405
|
+
"callMode": "create",
|
|
406
|
+
"c": code,
|
|
407
|
+
"ds": desc,
|
|
408
|
+
"n": name,
|
|
409
|
+
"f": 1,
|
|
410
|
+
}
|
|
411
|
+
if phone:
|
|
412
|
+
params.update({"p": quote_plus(phone)})
|
|
413
|
+
if custom_fields:
|
|
414
|
+
params.update({"jp": custom_fields})
|
|
415
|
+
self.session.wialon_api.resource_update_trailer(**params)
|
terminusgps/wialon/items/unit.py
CHANGED
|
@@ -200,13 +200,11 @@ class WialonUnit(WialonBase):
|
|
|
200
200
|
|
|
201
201
|
def clean_phone_numbers(self, phones: list[str]) -> list[str]:
|
|
202
202
|
"""Takes a list of phone numbers and returns a list of clean phone numbers."""
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
cleaned_phones.append(num)
|
|
209
|
-
return cleaned_phones
|
|
203
|
+
return [
|
|
204
|
+
clean_num
|
|
205
|
+
for num in phones
|
|
206
|
+
for clean_num in (num.split(",") if "," in num else [num])
|
|
207
|
+
]
|
|
210
208
|
|
|
211
209
|
def _get_afield_phone_numbers(self, key: str = "to_number") -> list[str] | None:
|
|
212
210
|
"""
|
terminusgps/wialon/utils.py
CHANGED
|
@@ -32,7 +32,7 @@ def get_hw_type_id(name: str, session: WialonSession) -> int | None:
|
|
|
32
32
|
return int(hw_types.get(name)) if name in hw_types.keys() else None
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
def
|
|
35
|
+
def get_id_from_imei(imei: str, session: WialonSession) -> str | None:
|
|
36
36
|
"""
|
|
37
37
|
Takes a Wialon unit's IMEI # and returns its unit id, if it exists.
|
|
38
38
|
|
|
@@ -50,7 +50,7 @@ def get_id_from_iccid(iccid: str, session: WialonSession) -> str | None:
|
|
|
50
50
|
"spec": {
|
|
51
51
|
"itemsType": "avl_unit",
|
|
52
52
|
"propName": "sys_unique_id",
|
|
53
|
-
"propValueMask": f"*{
|
|
53
|
+
"propValueMask": f"*{imei}*",
|
|
54
54
|
"sortType": "sys_unique_id",
|
|
55
55
|
"propType": "property",
|
|
56
56
|
"or_logic": 0,
|
|
@@ -66,6 +66,24 @@ def get_id_from_iccid(iccid: str, session: WialonSession) -> str | None:
|
|
|
66
66
|
return response["items"][0].get("id")
|
|
67
67
|
|
|
68
68
|
|
|
69
|
+
def get_id_from_iccid(iccid: str, session: WialonSession) -> str | None:
|
|
70
|
+
"""
|
|
71
|
+
DEPRECATED: Use :py:func:`~terminusgps.wialon.utils.get_id_from_imei`.
|
|
72
|
+
|
|
73
|
+
Takes a Wialon unit's IMEI # and returns its unit id, if it exists.
|
|
74
|
+
|
|
75
|
+
:param iccid: A unique id.
|
|
76
|
+
:type iccid: :py:obj:`str`
|
|
77
|
+
:param session: A valid Wialon API session.
|
|
78
|
+
:type session: :py:obj:`~terminusgps.wialon.session.WialonSession`
|
|
79
|
+
:raises WialonError: If something goes wrong with Wialon.
|
|
80
|
+
:returns: A Wialon object id, if it was found.
|
|
81
|
+
:rtype: :py:obj:`str` | :py:obj:`None`
|
|
82
|
+
|
|
83
|
+
"""
|
|
84
|
+
return get_id_from_imei(imei=iccid, session=session)
|
|
85
|
+
|
|
86
|
+
|
|
69
87
|
def get_wialon_cls(items_type: str) -> typing.Type[WialonBase]:
|
|
70
88
|
"""
|
|
71
89
|
Returns a Wialon object class based on items_type.
|
|
File without changes
|
{python_terminusgps-20.7.0.dist-info → python_terminusgps-21.2.0.dist-info}/licenses/COPYING
RENAMED
|
File without changes
|