tesla-fleet-api 0.5.14__py3-none-any.whl → 0.5.16__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 CHANGED
@@ -3,7 +3,7 @@
3
3
  from enum import Enum
4
4
  import logging
5
5
 
6
- VERSION = "0.5.14"
6
+ VERSION = "0.5.16"
7
7
  LOGGER = logging.getLogger(__package__)
8
8
  SERVERS = {
9
9
  "na": "https://fleet-api.prd.na.vn.cloud.tesla.com",
@@ -78,22 +78,44 @@ 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."""
81
+ class MissingToken(TeslaFleetError):
82
+ """Third party specific error when no access token is provided."""
83
83
 
84
84
  message = "Missing access token."
85
85
  status = 401
86
+
87
+
88
+ class MissingTeslemetryToken(MissingToken):
89
+ """Teslemetry specific error when no access token is provided."""
90
+
86
91
  key = "missing_token"
87
92
 
88
93
 
89
- class InvalidToken(TeslaFleetError): # Teslemetry specific
90
- """Teslemetry specific error for invalid access token."""
94
+ class MissingTessieToken(MissingToken):
95
+ """Tessie specific error when no access token is provided."""
96
+
97
+ key = "Access token is required"
98
+
91
99
 
92
- message = "Invalid Teslemetry access token."
100
+ class InvalidToken(TeslaFleetError):
101
+ """Third party specific error for invalid access token."""
102
+
103
+ message = "Invalid access token."
93
104
  status = 401
105
+
106
+
107
+ class InvalidTeslemetryToken(InvalidToken):
108
+ """Teslemetry specific error for invalid access token."""
109
+
94
110
  key = "invalid_token"
95
111
 
96
112
 
113
+ class InvalidTessieToken(InvalidToken):
114
+ """Tessie specific error for invalid access token."""
115
+
116
+ key = "Invalid access token"
117
+
118
+
97
119
  class OAuthExpired(TeslaFleetError):
98
120
  """The OAuth token has expired."""
99
121
 
@@ -301,8 +323,10 @@ async def raise_for_status(resp: aiohttp.ClientResponse) -> None:
301
323
  OAuthExpired,
302
324
  MobileAccessDisabled,
303
325
  LoginRequired,
304
- MissingToken,
305
- InvalidToken,
326
+ MissingTeslemetryToken,
327
+ MissingTessieToken,
328
+ InvalidTeslemetryToken,
329
+ InvalidTessieToken,
306
330
  ]:
307
331
  if error == exception.key:
308
332
  raise exception(data)
@@ -113,7 +113,6 @@ class TeslaFleetApi:
113
113
  params=params,
114
114
  ) as resp:
115
115
  LOGGER.debug("Response Status: %s", resp.status)
116
- print(resp.headers)
117
116
  if self.raise_for_status and not resp.ok:
118
117
  await raise_for_status(resp)
119
118
  elif resp.status == 401 and resp.content_type != "application/json":
@@ -130,7 +129,6 @@ class TeslaFleetApi:
130
129
 
131
130
  data = await resp.text()
132
131
  LOGGER.debug("Response Text: %s", data)
133
-
134
132
  return data
135
133
 
136
134
  async def status(self) -> str:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tesla_fleet_api
3
- Version: 0.5.14
3
+ Version: 0.5.16
4
4
  Summary: Tesla Fleet API library for Python
5
5
  Home-page: https://github.com/Teslemetry/tesla_fleet_api
6
6
  Author: Brett Adams
@@ -1,19 +1,19 @@
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=65FRapYVh74AeiD-J_VLu0ae3tJF4BiejrbDHxhDHpo,9278
3
+ tesla_fleet_api/const.py,sha256=-MYIW8BaV-B0w7dxx--sZyF7bZQslLsEtxZZ_vIYPy8,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=z_BTveVdKcVykrClC31vmMsvd7hC2vmfuu1rcueTTgo,10384
6
+ tesla_fleet_api/exceptions.py,sha256=3QUqIqA2wBqr-dpatDtmz8nOnqKN-pJ4gnIy6PMDQPs,10927
7
7
  tesla_fleet_api/partner.py,sha256=1vIBUaxKLIfqcC0X6VXZN0dMAzj_CLNPUMjA6QVqZ1k,1223
8
- tesla_fleet_api/teslafleetapi.py,sha256=wa7vFg6NYbb7yjp400c_Ls7iJ6H9-ykbnJuwnFRhjOs,5232
8
+ tesla_fleet_api/teslafleetapi.py,sha256=KYtfkqthYxWuKpctLbyAcE32sN5yMpJaCsMSWM7bX2E,5199
9
9
  tesla_fleet_api/teslafleetoauth.py,sha256=FfLnuqZMxF2HsZ5miLNtm3pRwKDoQKi2GD-oXgKxZgA,3594
10
10
  tesla_fleet_api/teslemetry.py,sha256=XOqm7SaakooJSNXEasJI_tRoCIyiFCD6n_PCx9U_D9g,2107
11
11
  tesla_fleet_api/tessie.py,sha256=Aso7pGcypG19Vgh8UBACJEdinbF5135e1aWdmrOxw7s,2182
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.14.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
16
- tesla_fleet_api-0.5.14.dist-info/METADATA,sha256=u0HTYUIamS8qCqfcrfZ7xqATYjXZQCJ-E1g7xvE_rEE,3962
17
- tesla_fleet_api-0.5.14.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
18
- tesla_fleet_api-0.5.14.dist-info/top_level.txt,sha256=jeNbog_1saXBFrGpom9WyPWmilxsyP3szL_G7JLWQfM,16
19
- tesla_fleet_api-0.5.14.dist-info/RECORD,,
15
+ tesla_fleet_api-0.5.16.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
16
+ tesla_fleet_api-0.5.16.dist-info/METADATA,sha256=Poyg10sjR6EfdB02U6m5fBWf6LrSzGBmHKv07JTir34,3962
17
+ tesla_fleet_api-0.5.16.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
18
+ tesla_fleet_api-0.5.16.dist-info/top_level.txt,sha256=jeNbog_1saXBFrGpom9WyPWmilxsyP3szL_G7JLWQfM,16
19
+ tesla_fleet_api-0.5.16.dist-info/RECORD,,