tesla-fleet-api 0.8.4__py3-none-any.whl → 0.9.0__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- tesla_fleet_api/const.py +5 -1
- tesla_fleet_api/teslafleetoauth.py +1 -1
- tesla_fleet_api/teslemetry.py +20 -9
- tesla_fleet_api/vehicle.py +1 -1
- {tesla_fleet_api-0.8.4.dist-info → tesla_fleet_api-0.9.0.dist-info}/METADATA +4 -1
- {tesla_fleet_api-0.8.4.dist-info → tesla_fleet_api-0.9.0.dist-info}/RECORD +9 -9
- {tesla_fleet_api-0.8.4.dist-info → tesla_fleet_api-0.9.0.dist-info}/WHEEL +1 -1
- {tesla_fleet_api-0.8.4.dist-info → tesla_fleet_api-0.9.0.dist-info}/LICENSE +0 -0
- {tesla_fleet_api-0.8.4.dist-info → tesla_fleet_api-0.9.0.dist-info}/top_level.txt +0 -0
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.
|
6
|
+
VERSION = "1.0.0"
|
7
7
|
LOGGER = logging.getLogger(__package__)
|
8
8
|
SERVERS = {
|
9
9
|
"na": "https://fleet-api.prd.na.vn.cloud.tesla.com",
|
@@ -88,11 +88,14 @@ class VehicleDataEndpoint(StrEnum):
|
|
88
88
|
DRIVE_STATE = "drive_state"
|
89
89
|
GUI_SETTINGS = "gui_settings"
|
90
90
|
LOCATION_DATA = "location_data"
|
91
|
+
CHARGE_SCHEDULE_DATA = "charge_schedule_data"
|
92
|
+
PRECONDITIONING_SCHEDULE_DATA = "preconditioning_schedule_data"
|
91
93
|
VEHICLE_CONFIG = "vehicle_config"
|
92
94
|
VEHICLE_STATE = "vehicle_state"
|
93
95
|
VEHICLE_DATA_COMBO = "vehicle_data_combo"
|
94
96
|
|
95
97
|
|
98
|
+
|
96
99
|
class SunRoofCommand(StrEnum):
|
97
100
|
"""Sunroof options"""
|
98
101
|
|
@@ -125,6 +128,7 @@ class Scope(StrEnum):
|
|
125
128
|
OFFLINE_ACCESS = "offline_access"
|
126
129
|
USER_DATA = "user_data"
|
127
130
|
VEHICLE_DEVICE_DATA = "vehicle_device_data"
|
131
|
+
VEHICLE_LOCATION = "vehicle_location"
|
128
132
|
VEHICLE_CMDS = "vehicle_cmds"
|
129
133
|
VEHICLE_CHARGING_CMDS = "vehicle_charging_cmds"
|
130
134
|
ENERGY_DEVICE_DATA = "energy_device_data"
|
@@ -45,7 +45,7 @@ class TeslaFleetOAuth(TeslaFleetApi):
|
|
45
45
|
"""Get the login URL."""
|
46
46
|
if self.redirect_uri is None:
|
47
47
|
raise ValueError("Redirect URI is missing")
|
48
|
-
return f"https://auth.tesla.com/oauth2/v3/authorize?response_type=code&prompt=login&client_id={self.client_id}&redirect_uri={self.redirect_uri}&scope={'
|
48
|
+
return f"https://auth.tesla.com/oauth2/v3/authorize?response_type=code&prompt=login&client_id={self.client_id}&redirect_uri={self.redirect_uri}&scope={'+'.join(scopes)}&state={state}"
|
49
49
|
|
50
50
|
async def get_refresh_token(self, code: str) -> None:
|
51
51
|
"""Get the refresh token."""
|
tesla_fleet_api/teslemetry.py
CHANGED
@@ -1,15 +1,10 @@
|
|
1
|
+
from typing import Any
|
2
|
+
|
1
3
|
import aiohttp
|
2
4
|
from aiolimiter import AsyncLimiter
|
3
|
-
from typing import Any
|
4
|
-
from .teslafleetapi import TeslaFleetApi
|
5
|
-
from .charging import Charging
|
6
|
-
from .energy import Energy
|
7
|
-
from .partner import Partner
|
8
|
-
from .user import User
|
9
|
-
from .vehicle import Vehicle
|
10
|
-
from .vehiclespecific import VehicleSpecific
|
11
5
|
|
12
|
-
from .const import
|
6
|
+
from .const import LOGGER, Method, VehicleDataEndpoint
|
7
|
+
from .teslafleetapi import TeslaFleetApi
|
13
8
|
|
14
9
|
# Rate limit should be global, even if multiple instances are created
|
15
10
|
rate_limit = AsyncLimiter(5, 10)
|
@@ -101,6 +96,22 @@ class Teslemetry(TeslaFleetApi):
|
|
101
96
|
)
|
102
97
|
).get("response")
|
103
98
|
|
99
|
+
async def vehicle_force_refresh(self, vin: str) -> dict[str, Any]:
|
100
|
+
"""Force a refresh of the vehicle data."""
|
101
|
+
return await self._request(
|
102
|
+
Method.GET,
|
103
|
+
f"api/force/{vin}",
|
104
|
+
)
|
105
|
+
|
106
|
+
async def vehicle_data_cached(self, vin: str, endpoints: list[VehicleDataEndpoint | str] | None = None,) -> dict[str, Any]:
|
107
|
+
"""Get cached vehicle data."""
|
108
|
+
endpoint_payload = ";".join(endpoints) if endpoints else None
|
109
|
+
return await self._request(
|
110
|
+
Method.GET,
|
111
|
+
f"api/x/vehicles/{vin}/vehicle_data",
|
112
|
+
{"endpoints": endpoint_payload}
|
113
|
+
)
|
114
|
+
|
104
115
|
async def _request(
|
105
116
|
self,
|
106
117
|
method: Method,
|
tesla_fleet_api/vehicle.py
CHANGED
@@ -737,7 +737,7 @@ class Vehicle:
|
|
737
737
|
async def vehicle_data(
|
738
738
|
self,
|
739
739
|
vehicle_tag: str | int,
|
740
|
-
endpoints:
|
740
|
+
endpoints: list[VehicleDataEndpoint | str] | None = None,
|
741
741
|
) -> dict[str, Any]:
|
742
742
|
"""Makes a live call to the vehicle. This may return cached data if the vehicle is offline. For vehicles running firmware versions 2023.38+, location_data is required to fetch vehicle location. This will result in a location sharing icon to show on the vehicle UI."""
|
743
743
|
endpoint_payload = ";".join(endpoints) if endpoints else None
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: tesla_fleet_api
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.9.0
|
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
|
@@ -13,7 +13,10 @@ Requires-Python: >=3.10
|
|
13
13
|
Description-Content-Type: text/markdown
|
14
14
|
License-File: LICENSE
|
15
15
|
Requires-Dist: aiohttp
|
16
|
+
Requires-Dist: aiofiles
|
16
17
|
Requires-Dist: aiolimiter
|
18
|
+
Requires-Dist: cryptography
|
19
|
+
Requires-Dist: protobuf
|
17
20
|
|
18
21
|
# Tesla Fleet Api
|
19
22
|
Python library for Tesla Fleet API and Teslemetry.
|
@@ -1,18 +1,18 @@
|
|
1
1
|
tesla_fleet_api/__init__.py,sha256=BVZUDsfaxT05tAfcMHHWiyFyXwmDOx_wP_IHZBscgho,729
|
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=uPDzAPkLLYOCo0lbYutDvp8WTuVPVz2a3tNc4bDKbT8,9738
|
4
4
|
tesla_fleet_api/energy.py,sha256=S7D75MPuMVsHgkyUcFfMqjGCLZBM5YVFlWLEHbaX-zw,5957
|
5
5
|
tesla_fleet_api/energyspecific.py,sha256=UfeaGE59aoAa8UhpQCXUi0sOrNCA40xZlqwF73BXTVY,4254
|
6
6
|
tesla_fleet_api/exceptions.py,sha256=wteuynQA2OY13IHEsiQHV-WU8BPUCpDDHBaYbRvQlHI,20299
|
7
7
|
tesla_fleet_api/partner.py,sha256=1vIBUaxKLIfqcC0X6VXZN0dMAzj_CLNPUMjA6QVqZ1k,1223
|
8
8
|
tesla_fleet_api/ratecalculator.py,sha256=4lz8yruUeouHXh_3ezsXX-CTpIegp1T1J4VuRV_qdHA,1791
|
9
9
|
tesla_fleet_api/teslafleetapi.py,sha256=4Rnh_HNZkIw54o9SYAaHsA8vY0pmk_bMncrLuJ8MtSk,7389
|
10
|
-
tesla_fleet_api/teslafleetoauth.py,sha256=
|
10
|
+
tesla_fleet_api/teslafleetoauth.py,sha256=ClrVh4_lpatW8w44fWM0PZiVB-ciPHr-9h4yw1Zf9w8,4121
|
11
11
|
tesla_fleet_api/teslafleetopensource.py,sha256=TJfVPcqJlA1b3kMoGuLr-g5Gn8UDyYsTZhjvGY1MtIk,2007
|
12
|
-
tesla_fleet_api/teslemetry.py,sha256=
|
12
|
+
tesla_fleet_api/teslemetry.py,sha256=l404hRZuZonOAp3x4hgiLfJTM84y9A-hCSoe1vo5c2k,3730
|
13
13
|
tesla_fleet_api/tessie.py,sha256=4dBYxe1G2v9JvJGRbb01wXrAmvWT4jOfV4f_VQE_vkE,2302
|
14
14
|
tesla_fleet_api/user.py,sha256=TZE2oh-n5zrhKXmGRuiNL9voKVODD7rBhGE_IObYVGA,1179
|
15
|
-
tesla_fleet_api/vehicle.py,sha256=
|
15
|
+
tesla_fleet_api/vehicle.py,sha256=rEaLBWK5Vd9K-SFnMy5jFEQK-6wxpVsyY1AJ-nmHm7c,31765
|
16
16
|
tesla_fleet_api/vehiclesigned.py,sha256=kxcR_I5B6I8ZsE336d22QDlVNpfxkdvRnW38XolLBsw,38698
|
17
17
|
tesla_fleet_api/vehiclespecific.py,sha256=Nr4zZzfmIuw3RFYjQEX6c_xtYZgztMsN5ohVn-YEH0I,20600
|
18
18
|
tesla_fleet_api/pb2/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -25,8 +25,8 @@ tesla_fleet_api/pb2/signatures_pb2.py,sha256=5mdJUC8EC8kx1UxYrHK5XI3_7M6v7w2POH1
|
|
25
25
|
tesla_fleet_api/pb2/universal_message_pb2.py,sha256=F6-SkYXSuzWDsBvnGMg9k2pAIZv13v609qCPx7NSrdw,7254
|
26
26
|
tesla_fleet_api/pb2/vcsec_pb2.py,sha256=CMJ97e4Mm4p7NFcgybbCC2KJRcvtrcqmBy_pGycYhMo,26238
|
27
27
|
tesla_fleet_api/pb2/vehicle_pb2.py,sha256=P1V7Dqg3BBGZwODxTpZqtxLP6fGS_FNBqJcz_Fp0crs,2482
|
28
|
-
tesla_fleet_api-0.
|
29
|
-
tesla_fleet_api-0.
|
30
|
-
tesla_fleet_api-0.
|
31
|
-
tesla_fleet_api-0.
|
32
|
-
tesla_fleet_api-0.
|
28
|
+
tesla_fleet_api-0.9.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
29
|
+
tesla_fleet_api-0.9.0.dist-info/METADATA,sha256=K8WV8VASy6Kg6e7WTyspglMEmN5CK-j0YFBc1lzn8As,3897
|
30
|
+
tesla_fleet_api-0.9.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
31
|
+
tesla_fleet_api-0.9.0.dist-info/top_level.txt,sha256=jeNbog_1saXBFrGpom9WyPWmilxsyP3szL_G7JLWQfM,16
|
32
|
+
tesla_fleet_api-0.9.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|