python-terminusgps 31.1.0__py3-none-any.whl → 31.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: 31.1.0
3
+ Version: 31.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
@@ -26,7 +26,9 @@ Description-Content-Type: text/markdown
26
26
 
27
27
  # python-terminusgps
28
28
 
29
- [python-terminusgps](https://docs.terminusgps.com/) is a collection of Python libraries intended for use by Terminus GPS developers.
29
+ *python-terminusgps* is a collection of Python libraries intended for use by Terminus GPS developers.
30
+
31
+ [Documentation](https://docs.terminusgps.com/)
30
32
 
31
33
  Currently, the following services are streamlined for web development:
32
34
 
@@ -34,3 +36,4 @@ Currently, the following services are streamlined for web development:
34
36
  * [Authorizenet API](https://developer.authorize.net/api/reference/index.html)
35
37
  * [Twilio API](https://www.twilio.com/docs)
36
38
  * [Wialon Remote API](https://sdk.wialon.com/wiki/en/sidebar/remoteapi/apiref/apiref)
39
+
@@ -14,7 +14,7 @@ terminusgps/aws/connect.py,sha256=TWf2bVz6LqSNQfVD7FKRn3K71VuLOwBj05Gs-9BsROg,69
14
14
  terminusgps/aws/secrets.py,sha256=MxQEmmBLpMUQ2tYAsHdCYf-7RZ84LiogdKcTsACX5dw,361
15
15
  terminusgps/django/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  terminusgps/django/mixins.py,sha256=Q9ZJuzpk3d9lDnlVA8ZTVvnZWxB13p08EQ8yVJcztn4,1034
17
- terminusgps/django/settings.py,sha256=vY5yNjyMu-7Ya0bIPWUvrrSLERtxHGdkfeoY4Ul6cP0,613
17
+ terminusgps/django/settings.py,sha256=cKUpFXH-uYWStvT6vzclczJAKwCGNx_2wY9-fqsbmIs,624
18
18
  terminusgps/django/utils.py,sha256=SYDQyHA5tTuVwdpZGsCtf0LpTTD0ilRKoxa8StfSTpQ,156
19
19
  terminusgps/twilio/__init__.py,sha256=dYo41F2jft_eHDWSUtSpKGSRG1bewq_qClqilUJZkYM,33
20
20
  terminusgps/twilio/caller.py,sha256=Q0wcJ5aaNDGvKfht7ARwPTFdqpFoB81DmZ_K2oZixyA,5077
@@ -23,8 +23,8 @@ terminusgps/wialon/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
23
23
  terminusgps/wialon/constants.py,sha256=-fRrvtQuSAJ6hpBJzp_Xa4GDI4LuQbqZ1z1L_QFzZiE,5609
24
24
  terminusgps/wialon/flags.py,sha256=M50EdhxQ8IMnJnU0mrHK7-h8Asc6tvNiTOOfd1dBW6A,12815
25
25
  terminusgps/wialon/logger.py,sha256=nUBsaLMaffSaAHGHAM6mFXDzix9hbNecVtA3INVtii8,968
26
- terminusgps/wialon/session.py,sha256=emB0XHJjFObtb6WbttsXZXTeRaPztcbjAV212B_Ssek,9781
27
- terminusgps/wialon/utils.py,sha256=eRo-NHWEi8zq8mMWFnCs8__iDbkpPvSkCqcsdr13ltI,9953
26
+ terminusgps/wialon/session.py,sha256=21ZRBUnsuK5zhkUHeccQW1lR39A4kQ_0qkLlRT1hsS8,10044
27
+ terminusgps/wialon/utils.py,sha256=JWHZ7VEeo8VNBH67gjOAQk5ITKuPllWDlJ4dVSQ5blA,11002
28
28
  terminusgps/wialon/validators.py,sha256=CVEpFsxqplEcpv4U2ipA6v9y5cSrMKFUXLvze-3vs4U,4223
29
29
  terminusgps/wialon/items/__init__.py,sha256=3BVthghekMvhMQSzQgBMlD_phxmKSmp3Zvmo-z0O8Bs,211
30
30
  terminusgps/wialon/items/base.py,sha256=y0z3eW_Gz7dlusKHj3T3TH3_nPsx5yGUKuImEJSK10M,10215
@@ -34,7 +34,7 @@ terminusgps/wialon/items/route.py,sha256=amNPKZqgl8pEzKA_XJudnvBPzEsfHTmrC7uF15s
34
34
  terminusgps/wialon/items/unit.py,sha256=jq4S8EV_yukRTTE8rr2oXpu_9AdXDFYA6-GCjkR6shw,12282
35
35
  terminusgps/wialon/items/unit_group.py,sha256=QV2ZZgICaN3n6W1pFIyMLyNKB6KYBsLyKG64i-qXoOg,4113
36
36
  terminusgps/wialon/items/user.py,sha256=N30wdejdG7LXrgafdKZH74YArGkX3xpZfTucn3m3aqM,7155
37
- python_terminusgps-31.1.0.dist-info/METADATA,sha256=MIfipx-9aKDFbozGWwy-i6MXtywcZMOk8O968CjS2TQ,1630
38
- python_terminusgps-31.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
39
- python_terminusgps-31.1.0.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
40
- python_terminusgps-31.1.0.dist-info/RECORD,,
37
+ python_terminusgps-31.2.0.dist-info/METADATA,sha256=EwPAAmEbYoZnSd8MUlqJErruNb1nS8UZ-iyKBrmE2x8,1648
38
+ python_terminusgps-31.2.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
39
+ python_terminusgps-31.2.0.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
40
+ python_terminusgps-31.2.0.dist-info/RECORD,,
@@ -1,15 +1,17 @@
1
1
  import os
2
2
  import pathlib
3
3
 
4
- DEBUG = True
5
4
  BASE_DIR = pathlib.Path(__file__).resolve().parent
5
+ DEBUG = True
6
+ SECRET_KEY = "xem*6no%8d9%^qzt2f3x3ar-uq4_+7h9myc$t0!+4%bj5us6f)"
7
+
8
+ # Secrets
9
+ CONNECT_SECRET = os.getenv("CONNECT_SECRET")
6
10
  MERCHANT_AUTH_LOGIN_ID = os.getenv("MERCHANT_AUTH_LOGIN_ID")
7
11
  MERCHANT_AUTH_TRANSACTION_KEY = os.getenv("MERCHANT_AUTH_TRANSACTION_KEY")
8
- SECRET_KEY = "xem*6no%8d9%^qzt2f3x3ar-uq4_+7h9myc$t0!+4%bj5us6f)"
9
12
  TWILIO_FROM_NUMBER = os.getenv("TWILIO_FROM_NUMBER")
10
13
  TWILIO_MESSAGING_SID = os.getenv("TWILIO_MESSAGING_SID")
11
14
  TWILIO_SID = os.getenv("TWILIO_SID")
12
15
  TWILIO_TOKEN = os.getenv("TWILIO_TOKEN")
13
16
  WIALON_ADMIN_ID = os.getenv("WIALON_ADMIN_ID")
14
17
  WIALON_TOKEN = os.getenv("WIALON_TOKEN")
15
- CONNECT_SECRET = os.getenv("CONNECT_SECRET")
@@ -105,13 +105,26 @@ class WialonSession:
105
105
  return f"{self.__class__}(sid={self.id})"
106
106
 
107
107
  def __enter__(self) -> "WialonSession":
108
- """Logs into the Wialon API using a token set in :py:meth:`__init__`."""
108
+ """
109
+ Logs into the Wialon API using :py:meth:`login`.
110
+
111
+ :raises AssertionError: If the Wialon API token was not set.
112
+ :returns: A valid Wialon API session.
113
+ :rtype: :py:obj:`~terminusgps.wialon.session.WialonSession`
114
+
115
+ """
109
116
  assert self.token, "Wialon API token was not set"
110
117
  self.login(self.token)
111
118
  return self
112
119
 
113
120
  def __exit__(self, exc_type, exc_value, exc_traceback) -> None:
114
- """Logs out of the session by calling :py:meth:`logout`."""
121
+ """
122
+ Logs out of the session by calling :py:meth:`logout`.
123
+
124
+ :returns: Nothing.
125
+ :rtype: :py:obj:`None`
126
+
127
+ """
115
128
  self.logout()
116
129
 
117
130
  @property
@@ -7,6 +7,36 @@ from .items import WialonResource, WialonUnit
7
7
  from .session import WialonSession
8
8
 
9
9
 
10
+ def get_user_by_name(name: str, session: WialonSession) -> WialonUnit | None:
11
+ """
12
+ Returns a Wialon user by name, if it exists.
13
+
14
+ :param name: A Wialon user name.
15
+ :type name: :py:obj:`str`
16
+ :param session: A valid Wialon API session.
17
+ :type session: :py:obj:`~terminusgps.wialon.session.WialonSession`
18
+ :returns: A Wialon unit, if any.
19
+ :rtype: :py:obj:`~terminusgps.wialon.items.unit.WialonUnit` | :py:obj:`None`
20
+
21
+ """
22
+ results: dict = session.wialon_api.core_search_items(
23
+ **{
24
+ "spec": {
25
+ "itemsType": constants.WialonItemsType.USER,
26
+ "propName": constants.WialonItemProperty.NAME,
27
+ "propValueMask": name,
28
+ "sortType": constants.WialonItemProperty.NAME,
29
+ },
30
+ "force": 0,
31
+ "flags": flags.DataFlag.USER_BASE,
32
+ "from": 0,
33
+ "to": 0,
34
+ }
35
+ )
36
+ if results and results.get("items", [{}]):
37
+ return WialonUnit(id=results.get("items", [{}])[0].get("id"), session=session)
38
+
39
+
10
40
  def get_carrier_names(session: WialonSession) -> list[str]:
11
41
  """
12
42
  Returns a list of all telecommunication carrier company names present in Wialon.