python-terminusgps 1.10.0__tar.gz → 1.10.2__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.
- {python_terminusgps-1.10.0 → python_terminusgps-1.10.2}/PKG-INFO +1 -1
- {python_terminusgps-1.10.0 → python_terminusgps-1.10.2}/pyproject.toml +1 -1
- python_terminusgps-1.10.2/terminusgps/__init__.py +20 -0
- {python_terminusgps-1.10.0 → python_terminusgps-1.10.2}/terminusgps/authorizenet/auth.py +0 -8
- python_terminusgps-1.10.2/terminusgps/twilio/__init__.py +1 -0
- {python_terminusgps-1.10.0 → python_terminusgps-1.10.2}/terminusgps/twilio/caller.py +6 -15
- {python_terminusgps-1.10.0 → python_terminusgps-1.10.2}/terminusgps/wialon/constants.py +1 -0
- {python_terminusgps-1.10.0 → python_terminusgps-1.10.2}/terminusgps/wialon/items/base.py +1 -0
- {python_terminusgps-1.10.0 → python_terminusgps-1.10.2}/terminusgps/wialon/items/unit.py +32 -12
- {python_terminusgps-1.10.0 → python_terminusgps-1.10.2}/terminusgps/wialon/items/user.py +1 -2
- {python_terminusgps-1.10.0 → python_terminusgps-1.10.2}/terminusgps/wialon/session.py +0 -5
- {python_terminusgps-1.10.0 → python_terminusgps-1.10.2}/terminusgps/wialon/utils.py +0 -1
- {python_terminusgps-1.10.0 → python_terminusgps-1.10.2}/uv.lock +1 -1
- python_terminusgps-1.10.0/requirements.txt +0 -50
- python_terminusgps-1.10.0/terminusgps/twilio/__init__.py +0 -0
- python_terminusgps-1.10.0/terminusgps/wialon/__init__.py +0 -0
- {python_terminusgps-1.10.0 → python_terminusgps-1.10.2}/.gitignore +0 -0
- {python_terminusgps-1.10.0 → python_terminusgps-1.10.2}/COPYING +0 -0
- {python_terminusgps-1.10.0 → python_terminusgps-1.10.2}/README.md +0 -0
- {python_terminusgps-1.10.0/terminusgps → python_terminusgps-1.10.2/terminusgps/authorizenet}/__init__.py +0 -0
- {python_terminusgps-1.10.0 → python_terminusgps-1.10.2}/terminusgps/authorizenet/profiles/__init__.py +0 -0
- {python_terminusgps-1.10.0 → python_terminusgps-1.10.2}/terminusgps/authorizenet/profiles/addresses.py +0 -0
- {python_terminusgps-1.10.0 → python_terminusgps-1.10.2}/terminusgps/authorizenet/profiles/base.py +0 -0
- {python_terminusgps-1.10.0 → python_terminusgps-1.10.2}/terminusgps/authorizenet/profiles/customers.py +0 -0
- {python_terminusgps-1.10.0 → python_terminusgps-1.10.2}/terminusgps/authorizenet/profiles/payments.py +0 -0
- {python_terminusgps-1.10.0/terminusgps/authorizenet → python_terminusgps-1.10.2/terminusgps/aws}/__init__.py +0 -0
- {python_terminusgps-1.10.0 → python_terminusgps-1.10.2}/terminusgps/aws/secrets.py +0 -0
- {python_terminusgps-1.10.0 → python_terminusgps-1.10.2}/terminusgps/settings.py +0 -0
- {python_terminusgps-1.10.0/terminusgps/aws → python_terminusgps-1.10.2/terminusgps/wialon}/__init__.py +0 -0
- {python_terminusgps-1.10.0 → python_terminusgps-1.10.2}/terminusgps/wialon/errors.py +0 -0
- {python_terminusgps-1.10.0 → python_terminusgps-1.10.2}/terminusgps/wialon/flags.py +0 -0
- {python_terminusgps-1.10.0 → python_terminusgps-1.10.2}/terminusgps/wialon/items/__init__.py +0 -0
- {python_terminusgps-1.10.0 → python_terminusgps-1.10.2}/terminusgps/wialon/items/resource.py +0 -0
- {python_terminusgps-1.10.0 → python_terminusgps-1.10.2}/terminusgps/wialon/items/retranslator.py +0 -0
- {python_terminusgps-1.10.0 → python_terminusgps-1.10.2}/terminusgps/wialon/items/route.py +0 -0
- {python_terminusgps-1.10.0 → python_terminusgps-1.10.2}/terminusgps/wialon/items/unit_group.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-terminusgps
|
|
3
|
-
Version: 1.10.
|
|
3
|
+
Version: 1.10.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://app.terminusgps.com/docs/apps/python-terminusgps/index.html
|
|
6
6
|
Project-URL: Repository, https://github.com/terminusgps/python-terminusgps
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "python-terminusgps"
|
|
3
|
-
version = "1.10.
|
|
3
|
+
version = "1.10.2"
|
|
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" } ]
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from django.conf import settings, ImproperlyConfigured
|
|
2
|
+
|
|
3
|
+
if not hasattr(settings, "DEBUG"):
|
|
4
|
+
raise ImproperlyConfigured("'DEBUG' setting is required.")
|
|
5
|
+
if not hasattr(settings, "MERCHANT_AUTH_LOGIN_ID"):
|
|
6
|
+
raise ImproperlyConfigured("'MERCHANT_AUTH_LOGIN_ID' setting is required.")
|
|
7
|
+
if not hasattr(settings, "MERCHANT_AUTH_TRANSACTION_KEY"):
|
|
8
|
+
raise ImproperlyConfigured("'MERCHANT_AUTH_TRANSACTION_KEY' setting is required.")
|
|
9
|
+
if not hasattr(settings, "TWILIO_FROM_NUMBER"):
|
|
10
|
+
raise ImproperlyConfigured("'TWILIO_FROM_NUMBER' setting is required.")
|
|
11
|
+
if not hasattr(settings, "TWILIO_MESSAGING_SID"):
|
|
12
|
+
raise ImproperlyConfigured("'TWILIO_MESSAGING_SID' setting is required.")
|
|
13
|
+
if not hasattr(settings, "TWILIO_SID"):
|
|
14
|
+
raise ImproperlyConfigured("'TWILIO_SID' setting is required.")
|
|
15
|
+
if not hasattr(settings, "TWILIO_TOKEN"):
|
|
16
|
+
raise ImproperlyConfigured("'TWILIO_TOKEN' setting is required.")
|
|
17
|
+
if not hasattr(settings, "WIALON_TOKEN"):
|
|
18
|
+
raise ImproperlyConfigured("'WIALON_TOKEN' setting is required.")
|
|
19
|
+
if not hasattr(settings, "WIALON_ADMIN_ID"):
|
|
20
|
+
raise ImproperlyConfigured("'WIALON_ADMIN_ID' setting is required.")
|
|
@@ -2,14 +2,6 @@ from authorizenet.apicontractsv1 import merchantAuthenticationType
|
|
|
2
2
|
from authorizenet.constants import constants
|
|
3
3
|
|
|
4
4
|
from django.conf import settings
|
|
5
|
-
from django.core.exceptions import ImproperlyConfigured
|
|
6
|
-
|
|
7
|
-
if not hasattr(settings, "DEBUG"):
|
|
8
|
-
raise ImproperlyConfigured("'DEBUG' setting is required.")
|
|
9
|
-
if not hasattr(settings, "MERCHANT_AUTH_LOGIN_ID"):
|
|
10
|
-
raise ImproperlyConfigured("'MERCHANT_AUTH_LOGIN_ID' setting is required.")
|
|
11
|
-
if not hasattr(settings, "MERCHANT_AUTH_TRANSACTION_KEY"):
|
|
12
|
-
raise ImproperlyConfigured("'MERCHANT_AUTH_TRANSACTION_KEY' setting is required.")
|
|
13
5
|
|
|
14
6
|
|
|
15
7
|
def get_merchant_auth() -> merchantAuthenticationType:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .caller import TwilioCaller
|
|
@@ -3,29 +3,20 @@ from typing import Any
|
|
|
3
3
|
import asyncio
|
|
4
4
|
import twilio.rest
|
|
5
5
|
|
|
6
|
-
from django.conf import settings
|
|
6
|
+
from django.conf import settings
|
|
7
7
|
from twilio.http.async_http_client import AsyncTwilioHttpClient
|
|
8
8
|
|
|
9
|
-
if not hasattr(settings, "TWILIO_FROM_NUMBER"):
|
|
10
|
-
raise ImproperlyConfigured("'TWILIO_FROM_NUMBER' setting is required.")
|
|
11
|
-
if not hasattr(settings, "TWILIO_MESSAGING_SID"):
|
|
12
|
-
raise ImproperlyConfigured("'TWILIO_MESSAGING_SID' setting is required.")
|
|
13
|
-
if not hasattr(settings, "TWILIO_SID"):
|
|
14
|
-
raise ImproperlyConfigured("'TWILIO_SID' setting is required.")
|
|
15
|
-
if not hasattr(settings, "TWILIO_TOKEN"):
|
|
16
|
-
raise ImproperlyConfigured("'TWILIO_TOKEN' setting is required.")
|
|
17
|
-
|
|
18
9
|
|
|
19
10
|
class TwilioCaller:
|
|
20
11
|
def __init__(self) -> None:
|
|
12
|
+
self.client_sid = settings.TWILIO_SID
|
|
13
|
+
self.client_token = settings.TWILIO_TOKEN
|
|
21
14
|
self.from_number = settings.TWILIO_FROM_NUMBER
|
|
22
|
-
self.
|
|
15
|
+
self.messaging_sid = settings.TWILIO_MESSAGING_SID
|
|
23
16
|
|
|
24
17
|
def __enter__(self) -> "TwilioCaller":
|
|
25
18
|
self.client = twilio.rest.Client(
|
|
26
|
-
|
|
27
|
-
settings.TWILIO_TOKEN,
|
|
28
|
-
http_client=AsyncTwilioHttpClient(),
|
|
19
|
+
self.client_sid, self.client_token, http_client=AsyncTwilioHttpClient()
|
|
29
20
|
)
|
|
30
21
|
return self
|
|
31
22
|
|
|
@@ -61,5 +52,5 @@ class TwilioCaller:
|
|
|
61
52
|
to=to_number,
|
|
62
53
|
from_=self.from_number,
|
|
63
54
|
body=message,
|
|
64
|
-
messaging_service_sid=self.
|
|
55
|
+
messaging_service_sid=self.messaging_sid,
|
|
65
56
|
)
|
|
@@ -144,9 +144,9 @@ class WialonUnit(WialonBase):
|
|
|
144
144
|
|
|
145
145
|
def get_phone_numbers(self) -> list[str]:
|
|
146
146
|
"""
|
|
147
|
-
Retrieves all phone numbers assigned to
|
|
147
|
+
Retrieves all phone numbers assigned to the unit.
|
|
148
148
|
|
|
149
|
-
This includes any attached drivers, custom fields,
|
|
149
|
+
This includes any attached drivers, custom/admin fields, or otherwise assigned phone numbers.
|
|
150
150
|
|
|
151
151
|
:raises WialonError: If something goes wrong with Wialon.
|
|
152
152
|
:returns: A list of phone numbers.
|
|
@@ -154,28 +154,48 @@ class WialonUnit(WialonBase):
|
|
|
154
154
|
|
|
155
155
|
"""
|
|
156
156
|
|
|
157
|
-
phone_numbers = []
|
|
158
|
-
phones_0 = self._get_driver_phone_numbers()
|
|
159
|
-
phones_1 = self._get_cfield_phone_numbers()
|
|
157
|
+
phone_numbers: list[str] = []
|
|
158
|
+
phones_0: list[str] | None = self._get_driver_phone_numbers()
|
|
159
|
+
phones_1: list[str] | None = self._get_cfield_phone_numbers()
|
|
160
|
+
phones_2: list[str] | None = self._get_afield_phone_numbers()
|
|
160
161
|
|
|
161
|
-
if phones_0:
|
|
162
|
+
if phones_0 is not None:
|
|
162
163
|
phone_numbers.extend(phones_0)
|
|
163
|
-
if phones_1:
|
|
164
|
+
if phones_1 is not None:
|
|
164
165
|
phone_numbers.extend(phones_1)
|
|
166
|
+
if phones_2 is not None:
|
|
167
|
+
phone_numbers.extend(phones_2)
|
|
165
168
|
return list(dict.fromkeys(phone_numbers)) # Removes duplicate phone numbers
|
|
166
169
|
|
|
167
|
-
def
|
|
170
|
+
def _get_afield_phone_numbers(self, key: str = "to_number") -> list[str] | None:
|
|
168
171
|
"""
|
|
169
|
-
Retrives any phone numbers saved in
|
|
172
|
+
Retrives any phone numbers saved in an admin field by key.
|
|
170
173
|
|
|
174
|
+
:param key: An admin field key. Default is ``"to_number"``.
|
|
175
|
+
:type key: :py:obj:`str`
|
|
176
|
+
:raises WialonError: If something goes wrong with Wialon.
|
|
177
|
+
:returns: A list of phone numbers, if the unit has admin phone number fields.
|
|
178
|
+
:rtype: :py:obj:`list` | :py:obj:`None`
|
|
179
|
+
|
|
180
|
+
"""
|
|
181
|
+
for field_name, field_val in self.afields.items():
|
|
182
|
+
if field_name == key:
|
|
183
|
+
return self.clean_phone_numbers([field_val])
|
|
184
|
+
|
|
185
|
+
def _get_cfield_phone_numbers(self, key: str = "to_number") -> list[str] | None:
|
|
186
|
+
"""
|
|
187
|
+
Retrives any phone numbers saved in a custom field by key.
|
|
188
|
+
|
|
189
|
+
:param key: A custom field key. Default is ``"to_number"``.
|
|
190
|
+
:type key: :py:obj:`str`
|
|
171
191
|
:raises WialonError: If something goes wrong with Wialon.
|
|
172
192
|
:returns: A list of phone numbers, if the unit has custom phone number fields.
|
|
173
193
|
:rtype: :py:obj:`list` | :py:obj:`None`
|
|
174
194
|
|
|
175
195
|
"""
|
|
176
|
-
for
|
|
177
|
-
if
|
|
178
|
-
return self.clean_phone_numbers([
|
|
196
|
+
for field_name, field_val in self.cfields.items():
|
|
197
|
+
if field_name == key:
|
|
198
|
+
return self.clean_phone_numbers([field_val])
|
|
179
199
|
|
|
180
200
|
def _get_driver_phone_numbers(self) -> list[str] | None:
|
|
181
201
|
"""
|
|
@@ -2,7 +2,6 @@ import threading
|
|
|
2
2
|
|
|
3
3
|
from wialon.api import Wialon, WialonError
|
|
4
4
|
from django.conf import settings
|
|
5
|
-
from django.core.exceptions import ImproperlyConfigured
|
|
6
5
|
|
|
7
6
|
from .errors import (
|
|
8
7
|
WialonLogoutError,
|
|
@@ -34,10 +33,6 @@ class WialonSession:
|
|
|
34
33
|
:rtype: :py:obj:`None`
|
|
35
34
|
|
|
36
35
|
"""
|
|
37
|
-
if not hasattr(settings, "WIALON_TOKEN"):
|
|
38
|
-
raise ImproperlyConfigured("'WIALON_TOKEN' setting is required.")
|
|
39
|
-
if not hasattr(settings, "WIALON_ADMIN_ID"):
|
|
40
|
-
raise ImproperlyConfigured("'WIALON_ADMIN_ID' setting is required.")
|
|
41
36
|
|
|
42
37
|
self.wialon_api = Wialon(scheme=scheme, host=host, port=port, sid=sid)
|
|
43
38
|
self.token = token
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
# This file was autogenerated by uv via the following command:
|
|
2
|
-
# uv pip compile pyproject.toml -o requirements.txt
|
|
3
|
-
argparse==1.4.0
|
|
4
|
-
# via python-terminusgps (pyproject.toml)
|
|
5
|
-
asgiref==3.8.1
|
|
6
|
-
# via django
|
|
7
|
-
authorizenet==1.1.5
|
|
8
|
-
# via python-terminusgps (pyproject.toml)
|
|
9
|
-
boto3==1.35.80
|
|
10
|
-
# via python-terminusgps (pyproject.toml)
|
|
11
|
-
botocore==1.35.80
|
|
12
|
-
# via
|
|
13
|
-
# boto3
|
|
14
|
-
# s3transfer
|
|
15
|
-
certifi==2024.8.30
|
|
16
|
-
# via requests
|
|
17
|
-
charset-normalizer==3.4.0
|
|
18
|
-
# via requests
|
|
19
|
-
django==5.1.4
|
|
20
|
-
# via python-terminusgps (pyproject.toml)
|
|
21
|
-
future==1.0.0
|
|
22
|
-
# via python-wialon
|
|
23
|
-
idna==3.10
|
|
24
|
-
# via requests
|
|
25
|
-
jmespath==1.0.1
|
|
26
|
-
# via
|
|
27
|
-
# boto3
|
|
28
|
-
# botocore
|
|
29
|
-
lxml==4.9.4
|
|
30
|
-
# via authorizenet
|
|
31
|
-
python-dateutil==2.9.0.post0
|
|
32
|
-
# via botocore
|
|
33
|
-
python-wialon==1.2.4
|
|
34
|
-
# via python-terminusgps (pyproject.toml)
|
|
35
|
-
pyxb-x==1.2.6.2
|
|
36
|
-
# via authorizenet
|
|
37
|
-
requests==2.32.3
|
|
38
|
-
# via authorizenet
|
|
39
|
-
s3transfer==0.10.4
|
|
40
|
-
# via boto3
|
|
41
|
-
simplejson==3.19.3
|
|
42
|
-
# via python-wialon
|
|
43
|
-
six==1.17.0
|
|
44
|
-
# via python-dateutil
|
|
45
|
-
sqlparse==0.5.3
|
|
46
|
-
# via django
|
|
47
|
-
urllib3==2.2.3
|
|
48
|
-
# via
|
|
49
|
-
# botocore
|
|
50
|
-
# requests
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_terminusgps-1.10.0 → python_terminusgps-1.10.2}/terminusgps/authorizenet/profiles/base.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_terminusgps-1.10.0 → python_terminusgps-1.10.2}/terminusgps/wialon/items/__init__.py
RENAMED
|
File without changes
|
{python_terminusgps-1.10.0 → python_terminusgps-1.10.2}/terminusgps/wialon/items/resource.py
RENAMED
|
File without changes
|
{python_terminusgps-1.10.0 → python_terminusgps-1.10.2}/terminusgps/wialon/items/retranslator.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_terminusgps-1.10.0 → python_terminusgps-1.10.2}/terminusgps/wialon/items/unit_group.py
RENAMED
|
File without changes
|