python-terminusgps 31.7.2__py3-none-any.whl → 31.8.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.
- {python_terminusgps-31.7.2.dist-info → python_terminusgps-31.8.0.dist-info}/METADATA +1 -1
- {python_terminusgps-31.7.2.dist-info → python_terminusgps-31.8.0.dist-info}/RECORD +6 -6
- terminusgps/authorizenet/utils.py +27 -0
- terminusgps/twilio/caller.py +13 -10
- {python_terminusgps-31.7.2.dist-info → python_terminusgps-31.8.0.dist-info}/WHEEL +0 -0
- {python_terminusgps-31.7.2.dist-info → python_terminusgps-31.8.0.dist-info}/licenses/COPYING +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-terminusgps
|
|
3
|
-
Version: 31.
|
|
3
|
+
Version: 31.8.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://docs.terminusgps.com
|
|
6
6
|
Project-URL: Repository, https://github.com/terminusgps/python-terminusgps
|
|
@@ -2,7 +2,7 @@ terminusgps/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
2
2
|
terminusgps/authorizenet/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
3
|
terminusgps/authorizenet/auth.py,sha256=umNpOXObDrIt2K40padWBedQl7tVAmEg2alBWhGk-qQ,1238
|
|
4
4
|
terminusgps/authorizenet/errors.py,sha256=HG5NwVxQCtOYidVl30y49PC0Ovw5VYdsy9wTgUFMw9M,949
|
|
5
|
-
terminusgps/authorizenet/utils.py,sha256=
|
|
5
|
+
terminusgps/authorizenet/utils.py,sha256=kfZD3w4mdDnlxajghD5Gy6NMRQkbPn78wplxHjlDAew,3829
|
|
6
6
|
terminusgps/authorizenet/profiles/__init__.py,sha256=IG4XCEEYtHKqXOatlZlob6J3ukAgF7cFR-RXxOSMS1c,161
|
|
7
7
|
terminusgps/authorizenet/profiles/addresses.py,sha256=7yrOrb9kIsiiazgWbeH8v_YUBiWG3Y61g46R3S5DD-k,6592
|
|
8
8
|
terminusgps/authorizenet/profiles/base.py,sha256=TOUHr22QRQBLErdysOkfcpJBusTjrUTqOmWEyNvMacA,2240
|
|
@@ -22,7 +22,7 @@ terminusgps/django/mixins.py,sha256=Q9ZJuzpk3d9lDnlVA8ZTVvnZWxB13p08EQ8yVJcztn4,
|
|
|
22
22
|
terminusgps/django/settings.py,sha256=yJIcBE0xjY60AXF_gonY5hS3ofseqPW2k9uSoELgoho,639
|
|
23
23
|
terminusgps/django/utils.py,sha256=SYDQyHA5tTuVwdpZGsCtf0LpTTD0ilRKoxa8StfSTpQ,156
|
|
24
24
|
terminusgps/twilio/__init__.py,sha256=dYo41F2jft_eHDWSUtSpKGSRG1bewq_qClqilUJZkYM,33
|
|
25
|
-
terminusgps/twilio/caller.py,sha256=
|
|
25
|
+
terminusgps/twilio/caller.py,sha256=l53-IxXn0wXc_oDcDxfhlrKPz-F4_KfMPV1dAzZjNo4,5060
|
|
26
26
|
terminusgps/twilio/validators.py,sha256=HWCpzgDXTedofty4Zhrm2OenbgtkzrDUC08B1l15gqc,1112
|
|
27
27
|
terminusgps/twilio/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
28
28
|
terminusgps/twilio/tests/test_caller.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -45,7 +45,7 @@ terminusgps/wialon/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
|
|
|
45
45
|
terminusgps/wialon/tests/test_items.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
46
46
|
terminusgps/wialon/tests/test_session.py,sha256=9mBlYchMo9NeqRIZsmxYzrM1zBHorqu4ooxqSNppLpI,1336
|
|
47
47
|
terminusgps/wialon/tests/test_utils.py,sha256=SK4PxJQGECFnzx_EQeRAQfsQ5_3FLaVcis2W9u_ibuI,1730
|
|
48
|
-
python_terminusgps-31.
|
|
49
|
-
python_terminusgps-31.
|
|
50
|
-
python_terminusgps-31.
|
|
51
|
-
python_terminusgps-31.
|
|
48
|
+
python_terminusgps-31.8.0.dist-info/METADATA,sha256=fWR5eNJ1iswS2-RqJNtYyzZRbOIO0EuG4JOHo8zdq5M,1581
|
|
49
|
+
python_terminusgps-31.8.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
50
|
+
python_terminusgps-31.8.0.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
51
|
+
python_terminusgps-31.8.0.dist-info/RECORD,,
|
|
@@ -56,6 +56,33 @@ def get_customer_profile_ids() -> list[int]:
|
|
|
56
56
|
return [int(id) for id in response.ids.getchildren()]
|
|
57
57
|
|
|
58
58
|
|
|
59
|
+
def get_customer_profile_id(email: str) -> int | None:
|
|
60
|
+
"""
|
|
61
|
+
Retrieves an Authorizenet customer profile id by email address.
|
|
62
|
+
|
|
63
|
+
:param email: A customer email address.
|
|
64
|
+
:type email: :py:obj:`str`
|
|
65
|
+
:raises ControllerExecutionError: If something goes wrong with the Authorizenet API.
|
|
66
|
+
:returns: A customer profile id, if found.
|
|
67
|
+
:rtype: :py:obj:`int` | :py:obj:`None`
|
|
68
|
+
|
|
69
|
+
"""
|
|
70
|
+
request = apicontractsv1.getCustomerProfileRequest(
|
|
71
|
+
merchantAuthentication=get_merchant_auth(), email=email, includeIssuerInfo=False
|
|
72
|
+
)
|
|
73
|
+
controller = apicontrollers.getCustomerProfileController(request)
|
|
74
|
+
controller.setenvironment(get_environment())
|
|
75
|
+
controller.execute()
|
|
76
|
+
response = controller.getresponse()
|
|
77
|
+
|
|
78
|
+
if response is not None and response.messages.resultCode != "Ok":
|
|
79
|
+
raise ControllerExecutionError(
|
|
80
|
+
message=response.messages.message[0]["text"].text,
|
|
81
|
+
code=response.messages.message[0]["code"].text,
|
|
82
|
+
)
|
|
83
|
+
return int(response.profile.customerProfileId)
|
|
84
|
+
|
|
85
|
+
|
|
59
86
|
def generate_customer_address(form: forms.Form) -> apicontractsv1.customerAddressType:
|
|
60
87
|
"""Takes a form and returns a :py:obj:`~authorizenet.apicontractsv1.customerAddressType`."""
|
|
61
88
|
address: apicontractsv1.customerAddressType = form.cleaned_data["address"]
|
terminusgps/twilio/caller.py
CHANGED
|
@@ -3,18 +3,9 @@ from typing import Any
|
|
|
3
3
|
|
|
4
4
|
import twilio.rest
|
|
5
5
|
from django.conf import settings
|
|
6
|
-
from
|
|
6
|
+
from loguru import logger
|
|
7
7
|
from twilio.http.async_http_client import AsyncTwilioHttpClient
|
|
8
8
|
|
|
9
|
-
if not hasattr(settings, "TWILIO_SID"):
|
|
10
|
-
raise ImproperlyConfigured("'TWILIO_SID' setting is required.")
|
|
11
|
-
if not hasattr(settings, "TWILIO_TOKEN"):
|
|
12
|
-
raise ImproperlyConfigured("'TWILIO_TOKEN' setting is required.")
|
|
13
|
-
if not hasattr(settings, "TWILIO_FROM_NUMBER"):
|
|
14
|
-
raise ImproperlyConfigured("'TWILIO_FROM_NUMBER' setting is required.")
|
|
15
|
-
if not hasattr(settings, "TWILIO_MESSAGING_SID"):
|
|
16
|
-
raise ImproperlyConfigured("'TWILIO_MESSAGING_SID' setting is required.")
|
|
17
|
-
|
|
18
9
|
|
|
19
10
|
class TwilioCaller:
|
|
20
11
|
def __init__(
|
|
@@ -23,6 +14,8 @@ class TwilioCaller:
|
|
|
23
14
|
client_token: str | None = None,
|
|
24
15
|
from_number: str | None = None,
|
|
25
16
|
messaging_sid: str | None = None,
|
|
17
|
+
log_level: int = 10,
|
|
18
|
+
log_days: int = 10,
|
|
26
19
|
) -> None:
|
|
27
20
|
"""
|
|
28
21
|
Sets Twilio client session variables.
|
|
@@ -41,6 +34,12 @@ class TwilioCaller:
|
|
|
41
34
|
:rtype: :py:obj:`None`
|
|
42
35
|
|
|
43
36
|
"""
|
|
37
|
+
logger.add(
|
|
38
|
+
f"logs/{self.__class__.__name__}.log",
|
|
39
|
+
level=log_level,
|
|
40
|
+
retention=f"{log_days} days",
|
|
41
|
+
diagnose=settings.DEBUG,
|
|
42
|
+
)
|
|
44
43
|
self._client_sid = client_sid or settings.TWILIO_SID
|
|
45
44
|
self._client_token = client_token or settings.TWILIO_TOKEN
|
|
46
45
|
self._from_number = from_number or settings.TWILIO_FROM_NUMBER
|
|
@@ -100,6 +99,8 @@ class TwilioCaller:
|
|
|
100
99
|
:rtype: :py:obj:`None`
|
|
101
100
|
|
|
102
101
|
"""
|
|
102
|
+
logger.info("Creating a call notification...")
|
|
103
|
+
logger.debug(f"Reading '{message}' to '{to_number}'...")
|
|
103
104
|
await self.client.calls.create_async(
|
|
104
105
|
to=to_number,
|
|
105
106
|
from_=self.from_number,
|
|
@@ -118,6 +119,8 @@ class TwilioCaller:
|
|
|
118
119
|
:rtype: :py:obj:`None`
|
|
119
120
|
|
|
120
121
|
"""
|
|
122
|
+
logger.info("Creating an sms notification...")
|
|
123
|
+
logger.debug(f"Texting '{message}' to '{to_number}'...")
|
|
121
124
|
await self.client.messages.create_async(
|
|
122
125
|
to=to_number,
|
|
123
126
|
from_=self.from_number,
|
|
File without changes
|
{python_terminusgps-31.7.2.dist-info → python_terminusgps-31.8.0.dist-info}/licenses/COPYING
RENAMED
|
File without changes
|