python-terminusgps 31.0.0__py3-none-any.whl → 31.0.1__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: 31.0.0
3
+ Version: 31.0.1
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
@@ -17,7 +17,7 @@ terminusgps/django/mixins.py,sha256=jzs_dH_YDmohH86I3uPnN-66C9OPVXaDPVdRHXA6vdk,
17
17
  terminusgps/django/settings.py,sha256=vY5yNjyMu-7Ya0bIPWUvrrSLERtxHGdkfeoY4Ul6cP0,613
18
18
  terminusgps/django/utils.py,sha256=SYDQyHA5tTuVwdpZGsCtf0LpTTD0ilRKoxa8StfSTpQ,156
19
19
  terminusgps/twilio/__init__.py,sha256=dYo41F2jft_eHDWSUtSpKGSRG1bewq_qClqilUJZkYM,33
20
- terminusgps/twilio/caller.py,sha256=TiQ4f0TDDC35he1M1iSsBM2vutdGriwtV4pc17T--6I,3552
20
+ terminusgps/twilio/caller.py,sha256=Q0wcJ5aaNDGvKfht7ARwPTFdqpFoB81DmZ_K2oZixyA,5077
21
21
  terminusgps/twilio/validators.py,sha256=nn7CCBTktNjcln6M4MR0ACxEsClgioSu89LRLgIiBZk,1112
22
22
  terminusgps/wialon/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
23
  terminusgps/wialon/constants.py,sha256=-fRrvtQuSAJ6hpBJzp_Xa4GDI4LuQbqZ1z1L_QFzZiE,5609
@@ -34,7 +34,7 @@ terminusgps/wialon/items/route.py,sha256=amNPKZqgl8pEzKA_XJudnvBPzEsfHTmrC7uF15s
34
34
  terminusgps/wialon/items/unit.py,sha256=ChONjm3wlFSlbNz-yEXziNbbs4LJ70F9-MI2c-p905k,10638
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.0.0.dist-info/METADATA,sha256=y4fXM6pCMkZ0znIWvVqoAOzitHrjZDbrhSDPIy06qcE,1061
38
- python_terminusgps-31.0.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
39
- python_terminusgps-31.0.0.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
40
- python_terminusgps-31.0.0.dist-info/RECORD,,
37
+ python_terminusgps-31.0.1.dist-info/METADATA,sha256=nrk9c775z_OXX5PVMLZgRkd4x_Butw1pspqwR_XyF48,1061
38
+ python_terminusgps-31.0.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
39
+ python_terminusgps-31.0.1.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
40
+ python_terminusgps-31.0.1.dist-info/RECORD,,
@@ -17,30 +17,53 @@ if not hasattr(settings, "TWILIO_MESSAGING_SID"):
17
17
 
18
18
 
19
19
  class TwilioCaller:
20
- def __init__(self) -> None:
21
- """Sets Twilio messaging session variables."""
22
- self.client_sid = settings.TWILIO_SID
23
- self.client_token = settings.TWILIO_TOKEN
24
- self.from_number = settings.TWILIO_FROM_NUMBER
25
- self.messaging_sid = settings.TWILIO_MESSAGING_SID
20
+ def __init__(
21
+ self,
22
+ client_sid: str | None = None,
23
+ client_token: str | None = None,
24
+ from_number: str | None = None,
25
+ messaging_sid: str | None = None,
26
+ ) -> None:
27
+ """
28
+ Sets Twilio client session variables.
29
+
30
+ All parameters are optional, default values are pulled from a Django settings module.
31
+
32
+ :param client_sid: A Twilio client session id.
33
+ :type client_sid: :py:obj:`str` | :py:obj:`None`
34
+ :param client_token: A Twilio client API token.
35
+ :type client_token: :py:obj:`str` | :py:obj:`None`
36
+ :param from_number: Phone number used to send notifications.
37
+ :type from_number: :py:obj:`str` | :py:obj:`None`
38
+ :param messaging_sid: A Twilio client messaging service session id.
39
+ :type messaging_sid: :py:obj:`str` | :py:obj:`None`
40
+ :returns: Nothing.
41
+ :rtype: :py:obj:`None`
42
+
43
+ """
44
+ self._client_sid = client_sid or settings.TWILIO_SID
45
+ self._client_token = client_token or settings.TWILIO_TOKEN
46
+ self._from_number = from_number or settings.TWILIO_FROM_NUMBER
47
+ self._messaging_sid = messaging_sid or settings.TWILIO_MESSAGING_SID
26
48
 
27
49
  def __enter__(self) -> "TwilioCaller":
28
- """Creates an asyncronous Twilio client."""
50
+ """Opens a context manager and creates an asyncronous Twilio client."""
29
51
  self.client = twilio.rest.Client(
30
- self.client_sid, self.client_token, http_client=AsyncTwilioHttpClient()
52
+ self.client_sid, self._client_token, http_client=AsyncTwilioHttpClient()
31
53
  )
32
54
  return self
33
55
 
34
56
  def __exit__(self, exc_type, exc_value, exc_tb) -> None:
57
+ """Closes the context manager."""
35
58
  return None
36
59
 
37
- async def create_notification(
60
+ def create_notification(
38
61
  self, to_number: str, message: str, method: str = "sms"
39
62
  ) -> asyncio.Task[Any]:
40
63
  """
41
64
  Returns an awaitable notification task.
42
65
 
43
- Available methods are ``"sms"``, ``"call"`` and ``"phone"``.
66
+ Valid methods are ``"sms"``, ``"call"`` and ``"phone"``.
44
67
 
45
68
  :param to_number: A phone number to notify.
46
69
  :type to_number: :py:obj:`str`
@@ -48,6 +71,7 @@ class TwilioCaller:
48
71
  :type message: :py:obj:`str`
49
72
  :param method: A notification method. Default is ``"sms"``.
50
73
  :type method: :py:obj:`str`
74
+ :raises ValueError: If ``method`` is invalid.
51
75
  :returns: An awaitable task.
52
76
  :rtype: :py:obj:`~asyncio.Task`
53
77
 
@@ -100,3 +124,33 @@ class TwilioCaller:
100
124
  body=message,
101
125
  messaging_service_sid=self.messaging_sid,
102
126
  )
127
+
128
+ @property
129
+ def client_sid(self) -> str:
130
+ """
131
+ Client session id.
132
+
133
+ :type: :py:obj:`str`
134
+
135
+ """
136
+ return self._client_sid
137
+
138
+ @property
139
+ def from_number(self) -> str:
140
+ """
141
+ Origin phone number.
142
+
143
+ :type: :py:obj:`str`
144
+
145
+ """
146
+ return self._from_number
147
+
148
+ @property
149
+ def messaging_sid(self) -> str:
150
+ """
151
+ Messaging service session id.
152
+
153
+ :type: :py:obj:`str`
154
+
155
+ """
156
+ return self._messaging_sid