tesla-fleet-api 0.0.1__tar.gz → 0.0.4__tar.gz
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-0.0.1/tesla_fleet_api.egg-info → tesla_fleet_api-0.0.4}/PKG-INFO +37 -3
- tesla_fleet_api-0.0.4/README.md +65 -0
- {tesla_fleet_api-0.0.1 → tesla_fleet_api-0.0.4}/setup.py +1 -1
- {tesla_fleet_api-0.0.1 → tesla_fleet_api-0.0.4}/tesla_fleet_api/TeslaFleetApi.py +715 -271
- tesla_fleet_api-0.0.4/tesla_fleet_api/TeslaFleetOAuth.py +67 -0
- tesla_fleet_api-0.0.4/tesla_fleet_api/Teslemetry.py +48 -0
- {tesla_fleet_api-0.0.1 → tesla_fleet_api-0.0.4}/tesla_fleet_api/__init__.py +0 -1
- tesla_fleet_api-0.0.4/tesla_fleet_api/const.py +256 -0
- tesla_fleet_api-0.0.4/tesla_fleet_api/exceptions.py +276 -0
- {tesla_fleet_api-0.0.1 → tesla_fleet_api-0.0.4/tesla_fleet_api.egg-info}/PKG-INFO +37 -3
- tesla_fleet_api-0.0.1/README.md +0 -31
- tesla_fleet_api-0.0.1/tesla_fleet_api/TeslaFleetOAuth.py +0 -21
- tesla_fleet_api-0.0.1/tesla_fleet_api/Teslemetry.py +0 -23
- tesla_fleet_api-0.0.1/tesla_fleet_api/const.py +0 -22
- tesla_fleet_api-0.0.1/tesla_fleet_api/exceptions.py +0 -218
- {tesla_fleet_api-0.0.1 → tesla_fleet_api-0.0.4}/LICENSE +0 -0
- {tesla_fleet_api-0.0.1 → tesla_fleet_api-0.0.4}/setup.cfg +0 -0
- {tesla_fleet_api-0.0.1 → tesla_fleet_api-0.0.4}/tesla_fleet_api.egg-info/SOURCES.txt +0 -0
- {tesla_fleet_api-0.0.1 → tesla_fleet_api-0.0.4}/tesla_fleet_api.egg-info/dependency_links.txt +0 -0
- {tesla_fleet_api-0.0.1 → tesla_fleet_api-0.0.4}/tesla_fleet_api.egg-info/requires.txt +0 -0
- {tesla_fleet_api-0.0.1 → tesla_fleet_api-0.0.4}/tesla_fleet_api.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: tesla_fleet_api
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.4
|
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
|
@@ -15,12 +15,16 @@ License-File: LICENSE
|
|
15
15
|
Requires-Dist: aiohttp
|
16
16
|
|
17
17
|
# tesla_fleet_api
|
18
|
-
Python library for Tesla Fleet API and Teslemetry
|
18
|
+
Python library for Tesla Fleet API and Teslemetry.
|
19
19
|
|
20
|
-
Currently does not support the
|
20
|
+
Currently does not support the end to end encrypted telemetry or command API.
|
21
21
|
|
22
22
|
Based on [Tesla Developer documentation](https://developer.tesla.com/docs/fleet-api).
|
23
23
|
|
24
|
+
|
25
|
+
## TeslaFleetApi
|
26
|
+
This is the base class, however can also be used directly if you have a valid user access_token.
|
27
|
+
|
24
28
|
```
|
25
29
|
import asyncio
|
26
30
|
import aiohttp
|
@@ -45,3 +49,33 @@ async def main():
|
|
45
49
|
|
46
50
|
asyncio.run(main())
|
47
51
|
```
|
52
|
+
|
53
|
+
## TeslaFleetOAuth
|
54
|
+
This extends TeslaFleetApi to support OAuth, and requires a client_id, and either a refresh_token or initial authentication code.
|
55
|
+
|
56
|
+
## Teslemetry
|
57
|
+
This extends TeslaFleetApi to send requests through Teslemetry, which manages all aspects of Tesla OAuth. This class only requires an access_token from the Teslemetry console.
|
58
|
+
|
59
|
+
```
|
60
|
+
import asyncio
|
61
|
+
import aiohttp
|
62
|
+
|
63
|
+
from tesla_fleet_api import Teslemetry, TeslaFleetError
|
64
|
+
|
65
|
+
|
66
|
+
async def main():
|
67
|
+
async with aiohttp.ClientSession() as session:
|
68
|
+
api = Teslemetry(
|
69
|
+
access_token="<access_token>",
|
70
|
+
session=session,
|
71
|
+
raise_for_status=True,
|
72
|
+
)
|
73
|
+
|
74
|
+
try:
|
75
|
+
data = await api.vehicle.list()
|
76
|
+
print(data)
|
77
|
+
except TeslaFleetError.Base as e:
|
78
|
+
print(e.message, e.error)
|
79
|
+
|
80
|
+
asyncio.run(main())
|
81
|
+
```
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# tesla_fleet_api
|
2
|
+
Python library for Tesla Fleet API and Teslemetry.
|
3
|
+
|
4
|
+
Currently does not support the end to end encrypted telemetry or command API.
|
5
|
+
|
6
|
+
Based on [Tesla Developer documentation](https://developer.tesla.com/docs/fleet-api).
|
7
|
+
|
8
|
+
|
9
|
+
## TeslaFleetApi
|
10
|
+
This is the base class, however can also be used directly if you have a valid user access_token.
|
11
|
+
|
12
|
+
```
|
13
|
+
import asyncio
|
14
|
+
import aiohttp
|
15
|
+
|
16
|
+
from tesla_fleet_api import TeslaFleetApi, TeslaFleetError
|
17
|
+
|
18
|
+
|
19
|
+
async def main():
|
20
|
+
async with aiohttp.ClientSession() as session:
|
21
|
+
api = TeslaFleetApi(
|
22
|
+
access_token="<access_token>",
|
23
|
+
session=session,
|
24
|
+
region="na",
|
25
|
+
raise_for_status=True,
|
26
|
+
)
|
27
|
+
|
28
|
+
try:
|
29
|
+
data = await api.vehicle.list()
|
30
|
+
print(data)
|
31
|
+
except TeslaFleetError.Base as e:
|
32
|
+
print(e.message, e.error)
|
33
|
+
|
34
|
+
asyncio.run(main())
|
35
|
+
```
|
36
|
+
|
37
|
+
## TeslaFleetOAuth
|
38
|
+
This extends TeslaFleetApi to support OAuth, and requires a client_id, and either a refresh_token or initial authentication code.
|
39
|
+
|
40
|
+
## Teslemetry
|
41
|
+
This extends TeslaFleetApi to send requests through Teslemetry, which manages all aspects of Tesla OAuth. This class only requires an access_token from the Teslemetry console.
|
42
|
+
|
43
|
+
```
|
44
|
+
import asyncio
|
45
|
+
import aiohttp
|
46
|
+
|
47
|
+
from tesla_fleet_api import Teslemetry, TeslaFleetError
|
48
|
+
|
49
|
+
|
50
|
+
async def main():
|
51
|
+
async with aiohttp.ClientSession() as session:
|
52
|
+
api = Teslemetry(
|
53
|
+
access_token="<access_token>",
|
54
|
+
session=session,
|
55
|
+
raise_for_status=True,
|
56
|
+
)
|
57
|
+
|
58
|
+
try:
|
59
|
+
data = await api.vehicle.list()
|
60
|
+
print(data)
|
61
|
+
except TeslaFleetError.Base as e:
|
62
|
+
print(e.message, e.error)
|
63
|
+
|
64
|
+
asyncio.run(main())
|
65
|
+
```
|