python-terminusgps 28.2.1__py3-none-any.whl → 28.4.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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-terminusgps
3
- Version: 28.2.1
3
+ Version: 28.4.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
@@ -1,5 +1,5 @@
1
1
  terminusgps/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- terminusgps/settings.py,sha256=UBj2tvuBzQDEz05PeFqHG4_ise3Bl6Iu7pxcrtjNaYE,568
2
+ terminusgps/settings.py,sha256=vY5yNjyMu-7Ya0bIPWUvrrSLERtxHGdkfeoY4Ul6cP0,613
3
3
  terminusgps/authorizenet/__init__.py,sha256=LiGLlWNNiqS7RSOP4Apabx-b9EBYyNbxRY_a0mvJoaE,466
4
4
  terminusgps/authorizenet/auth.py,sha256=ICxPPzoUc64VbsIIemEWKrn8xjHGwbNdo2VbtaFCFss,1107
5
5
  terminusgps/authorizenet/errors.py,sha256=HG5NwVxQCtOYidVl30y49PC0Ovw5VYdsy9wTgUFMw9M,949
@@ -11,6 +11,7 @@ terminusgps/authorizenet/profiles/customers.py,sha256=-F8IsQEn2CyHpfxyVZjKayHSuV
11
11
  terminusgps/authorizenet/profiles/payments.py,sha256=ohhZrs9MB7GkCi7jQvPVvELNKnR9BwzMd607jJmT4n4,11316
12
12
  terminusgps/authorizenet/profiles/subscriptions.py,sha256=zqXc-Cge8-a7mGWsDf7n2wH_JolmSHnbPYWKGwFCA_k,13120
13
13
  terminusgps/aws/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
+ terminusgps/aws/connect.py,sha256=jqx9czZ_QcH_HfovpySRzYRo2ZidNjQRVDXFN5m83Ww,722
14
15
  terminusgps/aws/secrets.py,sha256=MxQEmmBLpMUQ2tYAsHdCYf-7RZ84LiogdKcTsACX5dw,361
15
16
  terminusgps/twilio/__init__.py,sha256=dYo41F2jft_eHDWSUtSpKGSRG1bewq_qClqilUJZkYM,33
16
17
  terminusgps/twilio/caller.py,sha256=TiQ4f0TDDC35he1M1iSsBM2vutdGriwtV4pc17T--6I,3552
@@ -20,7 +21,7 @@ terminusgps/wialon/constants.py,sha256=n1ux68oWYWnzeZdN811Iw_Lk78KBM0YMJMoonn67u
20
21
  terminusgps/wialon/flags.py,sha256=_NIL3mrEGhvI5YISVjimjYtUatdgOqhZPJX368MtKSU,13959
21
22
  terminusgps/wialon/logger.py,sha256=nUBsaLMaffSaAHGHAM6mFXDzix9hbNecVtA3INVtii8,968
22
23
  terminusgps/wialon/session.py,sha256=THl88yfVBfRH8daKh1lmLSR8ro8TbyOokHx1Cev-En8,9638
23
- terminusgps/wialon/utils.py,sha256=T-r3IRw39LOFRvrCEKK7k_d9NWgWBbLxwb9E4zWnfG0,6901
24
+ terminusgps/wialon/utils.py,sha256=qhfO8BtCctd5WtJ6qA5poSpNlefVNA2q2l3S6t5FfTc,7753
24
25
  terminusgps/wialon/items/__init__.py,sha256=3BVthghekMvhMQSzQgBMlD_phxmKSmp3Zvmo-z0O8Bs,211
25
26
  terminusgps/wialon/items/base.py,sha256=GCSzhDc3bk-jltWYNL60BEYCeSNRsPWos5aeFvgye8Y,7208
26
27
  terminusgps/wialon/items/resource.py,sha256=vNR6hJmf23RxsqXpDhM0dODbQB8KKTKcy6ncjpEZty8,14610
@@ -29,7 +30,7 @@ terminusgps/wialon/items/route.py,sha256=8SzlqNmpYVdt-ZAY--B_KHoDIHgN0Zb7KBsBWAz
29
30
  terminusgps/wialon/items/unit.py,sha256=i7sQiRu3N0XxyTHVN2RnmjYy9X48KdnZLSB18ic37w8,9363
30
31
  terminusgps/wialon/items/unit_group.py,sha256=YsYh34l2DjSKcv5SIZkEVi5FSjveGB1gxU2fwdLyvl4,4101
31
32
  terminusgps/wialon/items/user.py,sha256=PFYBie04F16YE2B5364PLxkmlTmQr4sZXpItvRBxsDc,7143
32
- python_terminusgps-28.2.1.dist-info/METADATA,sha256=XsfdJp5JSwL8Ahc8GFx0MihoSFXHp272MTxU9uRmHIQ,946
33
- python_terminusgps-28.2.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
34
- python_terminusgps-28.2.1.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
35
- python_terminusgps-28.2.1.dist-info/RECORD,,
33
+ python_terminusgps-28.4.0.dist-info/METADATA,sha256=Tw-hrdqiX9lKFPpd7x1ce5UqCA0SkCFrdyG6DCr_ZRU,946
34
+ python_terminusgps-28.4.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
35
+ python_terminusgps-28.4.0.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
36
+ python_terminusgps-28.4.0.dist-info/RECORD,,
@@ -0,0 +1,16 @@
1
+ import jwt
2
+ import datetime
3
+
4
+ from django.conf import settings
5
+
6
+ def get_aws_connect_jwt(widget_id: str, expires_in: int = 500) -> str:
7
+ payload = {
8
+ "sub": widget_id,
9
+ "iat": datetime.datetime.utcnow(),
10
+ "exp": datetime.datetime.utcnow() - datetime.timedelta(seconds=expires_in),
11
+ "customerId": "",
12
+ "segmentAttributes": {"connect:Subtype": {"ValueString" : "connect:Guide"}}, 'attributes': {"name": "Jane", "memberID": "123456789", "email": "Jane@example.com", "isPremiumUser": "true", "age": "45"} },
13
+ }
14
+ header = {"typ": "JWT", "alg": "HS256"}
15
+ encoded_token = jwt.encode((payload), settings.CONNECT_SECRET, algorithm=header["alg"], headers=header)
16
+ return encoded_token
terminusgps/settings.py CHANGED
@@ -12,3 +12,4 @@ TWILIO_SID = os.getenv("TWILIO_SID")
12
12
  TWILIO_TOKEN = os.getenv("TWILIO_TOKEN")
13
13
  WIALON_ADMIN_ID = os.getenv("WIALON_ADMIN_ID")
14
14
  WIALON_TOKEN = os.getenv("WIALON_TOKEN")
15
+ CONNECT_SECRET = os.getenv("CONNECT_SECRET")
@@ -7,6 +7,36 @@ from terminusgps.wialon.items.base import WialonBase
7
7
  from terminusgps.wialon.session import WialonSession
8
8
 
9
9
 
10
+ def get_resource_ids(session: WialonSession) -> list[int] | None:
11
+ """
12
+ Returns a list of all resource ids in Wialon.
13
+
14
+ :param session: A valid Wialon API session.
15
+ :type session: :py:obj:`~terminusgps.wialon.session.WialonSession`
16
+ :returns: A list of account ids.
17
+ :rtype: :py:obj:`list`
18
+
19
+ """
20
+ results = session.wialon_api.core_search_items(
21
+ **{
22
+ "spec": {
23
+ "itemsType": "avl_resource",
24
+ "propName": "sys_id",
25
+ "propValueMask": "*",
26
+ "sortType": "sys_id",
27
+ "propType": "property",
28
+ "or_logic": False,
29
+ },
30
+ "force": 0,
31
+ "flags": 1,
32
+ "from": 0,
33
+ "to": 0,
34
+ }
35
+ )
36
+ if results:
37
+ return [int(item.get("id")) for item in results.get("items", [])]
38
+
39
+
10
40
  def get_hw_type_id(name: str, session: WialonSession) -> int | None:
11
41
  """
12
42
  Takes a Wialon hardware type name and returns its id, if it exists.