python-terminusgps 1.10.1__py3-none-any.whl → 1.10.2__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: 1.10.1
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
@@ -10,7 +10,7 @@ terminusgps/authorizenet/profiles/payments.py,sha256=qOWp-gO6qBCADP98WjoNCHm-jtq
10
10
  terminusgps/aws/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  terminusgps/aws/secrets.py,sha256=kgRA77rs0mD4berWRLkPtJLOe4Grf--o5f8NzwQqXCk,360
12
12
  terminusgps/twilio/__init__.py,sha256=dYo41F2jft_eHDWSUtSpKGSRG1bewq_qClqilUJZkYM,33
13
- terminusgps/twilio/caller.py,sha256=l7X7nGTGRSp1pnxg0596Bvds6srPWvQUDZAdnuh6H9s,1785
13
+ terminusgps/twilio/caller.py,sha256=XLMONHnojYZ0QVS0UlJlBZkL2qw3LO2b53jWJ4uv6oM,1832
14
14
  terminusgps/wialon/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
15
  terminusgps/wialon/constants.py,sha256=g06sNgWtSvY1pZljbH9KMsArhs8jFZRgJM9GT4Gluf0,3079
16
16
  terminusgps/wialon/errors.py,sha256=SV9pVwU6FZ_zGlGP6zJN6aLE2auF4TfHFISQLiPMKrI,1758
@@ -22,10 +22,10 @@ terminusgps/wialon/items/base.py,sha256=r0cDn7c1vKVARPmODbGPkeP2F-sktCqVofIb1Q_g
22
22
  terminusgps/wialon/items/resource.py,sha256=xElMYSMyKA5y8rIP0EeF429MBV2hbLZcS6SokftvrOs,5641
23
23
  terminusgps/wialon/items/retranslator.py,sha256=zsQXqOhH1zFe5_e8DROPu60z3v6xPWOEPyMCi2IqJAo,3861
24
24
  terminusgps/wialon/items/route.py,sha256=qOHPN_rejwiGqvwWzlwmUIAIyc3lKavCalf8ki66rx0,760
25
- terminusgps/wialon/items/unit.py,sha256=mEYQRpICELQPR3dyDJVRzoKeIuFRnPgkqK-Oo6xuIP4,6306
25
+ terminusgps/wialon/items/unit.py,sha256=AUPoECgjzxnBxTAjPCbSVL_OzqCP7Oa4vjprFT3gJJ8,7275
26
26
  terminusgps/wialon/items/unit_group.py,sha256=1yc7ldPIgGbtiTj0djRDWmt6Q9K_VT9sxOaioasbbLY,5212
27
27
  terminusgps/wialon/items/user.py,sha256=p_NA4iXLappr44RKwt9EHv_v0jc1XOQU_mJWe61s_qI,6077
28
- python_terminusgps-1.10.1.dist-info/METADATA,sha256=Scly_sQtcpOmp_7zUEOKuJphFZZw1LAanqzh7iiqA2c,912
29
- python_terminusgps-1.10.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
30
- python_terminusgps-1.10.1.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
31
- python_terminusgps-1.10.1.dist-info/RECORD,,
28
+ python_terminusgps-1.10.2.dist-info/METADATA,sha256=mOx5v7vNDP2-65IJpMHgC2epvklGGClRyb2FGrjPEjE,912
29
+ python_terminusgps-1.10.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
30
+ python_terminusgps-1.10.2.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
31
+ python_terminusgps-1.10.2.dist-info/RECORD,,
@@ -9,14 +9,14 @@ from twilio.http.async_http_client import AsyncTwilioHttpClient
9
9
 
10
10
  class TwilioCaller:
11
11
  def __init__(self) -> None:
12
+ self.client_sid = settings.TWILIO_SID
13
+ self.client_token = settings.TWILIO_TOKEN
12
14
  self.from_number = settings.TWILIO_FROM_NUMBER
13
- self.messaging_service_sid = settings.TWILIO_MESSAGING_SID
15
+ self.messaging_sid = settings.TWILIO_MESSAGING_SID
14
16
 
15
17
  def __enter__(self) -> "TwilioCaller":
16
18
  self.client = twilio.rest.Client(
17
- settings.TWILIO_SID,
18
- settings.TWILIO_TOKEN,
19
- http_client=AsyncTwilioHttpClient(),
19
+ self.client_sid, self.client_token, http_client=AsyncTwilioHttpClient()
20
20
  )
21
21
  return self
22
22
 
@@ -52,5 +52,5 @@ class TwilioCaller:
52
52
  to=to_number,
53
53
  from_=self.from_number,
54
54
  body=message,
55
- messaging_service_sid=self.messaging_service_sid,
55
+ messaging_service_sid=self.messaging_sid,
56
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 this Wialon unit.
147
+ Retrieves all phone numbers assigned to the unit.
148
148
 
149
- This includes any attached drivers, custom fields, and normally assigned unit phone numbers.
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 _get_cfield_phone_numbers(self) -> list[str] | None:
170
+ def _get_afield_phone_numbers(self, key: str = "to_number") -> list[str] | None:
168
171
  """
169
- Retrives any phone numbers saved in the unit's custom 'to_number' field.
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 key, value in self.cfields.items():
177
- if key == "to_number":
178
- return self.clean_phone_numbers([value])
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
  """