tesla-fleet-api 0.5.11__py3-none-any.whl → 0.5.12__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.
- tesla_fleet_api/const.py +1 -1
- tesla_fleet_api/exceptions.py +43 -3
- {tesla_fleet_api-0.5.11.dist-info → tesla_fleet_api-0.5.12.dist-info}/METADATA +1 -1
- {tesla_fleet_api-0.5.11.dist-info → tesla_fleet_api-0.5.12.dist-info}/RECORD +7 -7
- {tesla_fleet_api-0.5.11.dist-info → tesla_fleet_api-0.5.12.dist-info}/LICENSE +0 -0
- {tesla_fleet_api-0.5.11.dist-info → tesla_fleet_api-0.5.12.dist-info}/WHEEL +0 -0
- {tesla_fleet_api-0.5.11.dist-info → tesla_fleet_api-0.5.12.dist-info}/top_level.txt +0 -0
tesla_fleet_api/const.py
CHANGED
tesla_fleet_api/exceptions.py
CHANGED
@@ -78,6 +78,14 @@ class MobileAccessDisabled(TeslaFleetError):
|
|
78
78
|
key = "mobile_access_disabled"
|
79
79
|
|
80
80
|
|
81
|
+
class MissingToken(TeslaFleetError): # Teslemetry specific
|
82
|
+
"""Teslemetry specific error when no access token is provided."""
|
83
|
+
|
84
|
+
message = "Missing access token."
|
85
|
+
status = 401
|
86
|
+
key = "missing_token"
|
87
|
+
|
88
|
+
|
81
89
|
class InvalidToken(TeslaFleetError): # Teslemetry specific
|
82
90
|
"""Teslemetry specific error for invalid access token."""
|
83
91
|
|
@@ -94,6 +102,14 @@ class OAuthExpired(TeslaFleetError):
|
|
94
102
|
key = "token expired (401)"
|
95
103
|
|
96
104
|
|
105
|
+
class LoginRequired(TeslaFleetError): # Native and Teslemetry
|
106
|
+
"""The user has reset their password and a new auth code is required, or the refresh_token has already been used."""
|
107
|
+
|
108
|
+
message = "The user has reset their password and a new auth code is required, or the refresh_token has already been used."
|
109
|
+
status = 401
|
110
|
+
key = "login_required"
|
111
|
+
|
112
|
+
|
97
113
|
class PaymentRequired(TeslaFleetError):
|
98
114
|
"""Payment is required in order to use the API (non-free account only)."""
|
99
115
|
|
@@ -101,7 +117,7 @@ class PaymentRequired(TeslaFleetError):
|
|
101
117
|
status = 402
|
102
118
|
|
103
119
|
|
104
|
-
class SubscriptionRequired(TeslaFleetError):
|
120
|
+
class SubscriptionRequired(TeslaFleetError): # Teslemetry specific
|
105
121
|
"""Subscription is required in order to use Teslemetry."""
|
106
122
|
|
107
123
|
message = "Subscription is required in order to use Teslemetry."
|
@@ -132,6 +148,14 @@ class NotFound(TeslaFleetError):
|
|
132
148
|
status = 404
|
133
149
|
|
134
150
|
|
151
|
+
class InvalidMethod(TeslaFleetError):
|
152
|
+
"""The HTTP method is not allowed."""
|
153
|
+
|
154
|
+
message = "The HTTP method is not allowed."
|
155
|
+
status = 405
|
156
|
+
key = "invalid_method"
|
157
|
+
|
158
|
+
|
135
159
|
class NotAllowed(TeslaFleetError):
|
136
160
|
"""The operation is not allowed."""
|
137
161
|
|
@@ -183,6 +207,13 @@ class Locked(TeslaFleetError):
|
|
183
207
|
status = 423
|
184
208
|
|
185
209
|
|
210
|
+
class InvalidResponse(TeslaFleetError):
|
211
|
+
"""The response from Tesla was invalid."""
|
212
|
+
|
213
|
+
message = "The response from Tesla was invalid."
|
214
|
+
status = 424
|
215
|
+
|
216
|
+
|
186
217
|
class RateLimited(TeslaFleetError):
|
187
218
|
"""Account or server is rate limited."""
|
188
219
|
|
@@ -266,10 +297,15 @@ async def raise_for_status(resp: aiohttp.ClientResponse) -> None:
|
|
266
297
|
raise InvalidRequest(data)
|
267
298
|
elif resp.status == 401:
|
268
299
|
if error:
|
269
|
-
for exception in [
|
300
|
+
for exception in [
|
301
|
+
OAuthExpired,
|
302
|
+
MobileAccessDisabled,
|
303
|
+
LoginRequired,
|
304
|
+
MissingToken,
|
305
|
+
InvalidToken,
|
306
|
+
]:
|
270
307
|
if error == exception.key:
|
271
308
|
raise exception(data)
|
272
|
-
raise InvalidToken(data)
|
273
309
|
# This error does not return a body
|
274
310
|
raise OAuthExpired()
|
275
311
|
elif resp.status == 402:
|
@@ -283,6 +319,8 @@ async def raise_for_status(resp: aiohttp.ClientResponse) -> None:
|
|
283
319
|
elif resp.status == 404:
|
284
320
|
raise NotFound(data)
|
285
321
|
elif resp.status == 405:
|
322
|
+
if error == InvalidMethod.key:
|
323
|
+
raise InvalidMethod(data)
|
286
324
|
raise NotAllowed(data)
|
287
325
|
elif resp.status == 406:
|
288
326
|
raise NotAcceptable(data)
|
@@ -296,6 +334,8 @@ async def raise_for_status(resp: aiohttp.ClientResponse) -> None:
|
|
296
334
|
raise InvalidResource(data)
|
297
335
|
elif resp.status == 423:
|
298
336
|
raise Locked(data)
|
337
|
+
elif resp.status == 424:
|
338
|
+
raise InvalidResponse(data)
|
299
339
|
elif resp.status == 429:
|
300
340
|
raise RateLimited(data)
|
301
341
|
elif resp.status == 451:
|
@@ -1,9 +1,9 @@
|
|
1
1
|
tesla_fleet_api/__init__.py,sha256=0MON9vh3AShIiX16FZ6NU3yZ7kyXFh5GxA0rY8CzVRM,584
|
2
2
|
tesla_fleet_api/charging.py,sha256=N_mc8axrXj3iduqLj_jCt4Vx86tHqe3xqQT4R1R7HvU,1689
|
3
|
-
tesla_fleet_api/const.py,sha256=
|
3
|
+
tesla_fleet_api/const.py,sha256=SvZTw4hP7ylCzIOF7JqFO9enjNehKMLz2OVQSNo1aeQ,9278
|
4
4
|
tesla_fleet_api/energy.py,sha256=kE-HDupzhgatIsizJoer1MAALP-wH6jjjGliiRQN0Os,5285
|
5
5
|
tesla_fleet_api/energyspecific.py,sha256=kICxdeDoWR9JHlgjHvnmjJ1ErLOWJT8bCSESoXo9axU,3732
|
6
|
-
tesla_fleet_api/exceptions.py,sha256=
|
6
|
+
tesla_fleet_api/exceptions.py,sha256=z_BTveVdKcVykrClC31vmMsvd7hC2vmfuu1rcueTTgo,10384
|
7
7
|
tesla_fleet_api/partner.py,sha256=1vIBUaxKLIfqcC0X6VXZN0dMAzj_CLNPUMjA6QVqZ1k,1223
|
8
8
|
tesla_fleet_api/teslafleetapi.py,sha256=KYtfkqthYxWuKpctLbyAcE32sN5yMpJaCsMSWM7bX2E,5199
|
9
9
|
tesla_fleet_api/teslafleetoauth.py,sha256=FfLnuqZMxF2HsZ5miLNtm3pRwKDoQKi2GD-oXgKxZgA,3594
|
@@ -12,8 +12,8 @@ tesla_fleet_api/tessie.py,sha256=ZttWuDdQOuTFO4k-BMq7fXKP3Nb4Dsxk3gFJprHHsco,221
|
|
12
12
|
tesla_fleet_api/user.py,sha256=TZE2oh-n5zrhKXmGRuiNL9voKVODD7rBhGE_IObYVGA,1179
|
13
13
|
tesla_fleet_api/vehicle.py,sha256=qM0lD4JnZOrlqHCLnXEpTQoVGUTiWr--tdTB8wKJrfA,32871
|
14
14
|
tesla_fleet_api/vehiclespecific.py,sha256=Oaz5InhWwXuKgyoQSYWpLLsMPjZ2iF0bShlnDLxEk5k,21506
|
15
|
-
tesla_fleet_api-0.5.
|
16
|
-
tesla_fleet_api-0.5.
|
17
|
-
tesla_fleet_api-0.5.
|
18
|
-
tesla_fleet_api-0.5.
|
19
|
-
tesla_fleet_api-0.5.
|
15
|
+
tesla_fleet_api-0.5.12.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
16
|
+
tesla_fleet_api-0.5.12.dist-info/METADATA,sha256=MLyYcDdbJi08s1J2DqhKr-z3HTZen3T2n138khOiXgc,3962
|
17
|
+
tesla_fleet_api-0.5.12.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
18
|
+
tesla_fleet_api-0.5.12.dist-info/top_level.txt,sha256=jeNbog_1saXBFrGpom9WyPWmilxsyP3szL_G7JLWQfM,16
|
19
|
+
tesla_fleet_api-0.5.12.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|