tesla-fleet-api 0.5.1__tar.gz → 0.5.3__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.5.1/tesla_fleet_api.egg-info → tesla_fleet_api-0.5.3}/PKG-INFO +3 -3
- {tesla_fleet_api-0.5.1 → tesla_fleet_api-0.5.3}/setup.py +3 -3
- {tesla_fleet_api-0.5.1 → tesla_fleet_api-0.5.3}/tesla_fleet_api/const.py +8 -9
- {tesla_fleet_api-0.5.1 → tesla_fleet_api-0.5.3}/tesla_fleet_api/teslafleetapi.py +3 -1
- {tesla_fleet_api-0.5.1 → tesla_fleet_api-0.5.3}/tesla_fleet_api/teslemetry.py +11 -6
- {tesla_fleet_api-0.5.1 → tesla_fleet_api-0.5.3/tesla_fleet_api.egg-info}/PKG-INFO +3 -3
- {tesla_fleet_api-0.5.1 → tesla_fleet_api-0.5.3}/LICENSE +0 -0
- {tesla_fleet_api-0.5.1 → tesla_fleet_api-0.5.3}/README.md +0 -0
- {tesla_fleet_api-0.5.1 → tesla_fleet_api-0.5.3}/setup.cfg +0 -0
- {tesla_fleet_api-0.5.1 → tesla_fleet_api-0.5.3}/tesla_fleet_api/__init__.py +0 -0
- {tesla_fleet_api-0.5.1 → tesla_fleet_api-0.5.3}/tesla_fleet_api/charging.py +0 -0
- {tesla_fleet_api-0.5.1 → tesla_fleet_api-0.5.3}/tesla_fleet_api/energy.py +0 -0
- {tesla_fleet_api-0.5.1 → tesla_fleet_api-0.5.3}/tesla_fleet_api/energyspecific.py +0 -0
- {tesla_fleet_api-0.5.1 → tesla_fleet_api-0.5.3}/tesla_fleet_api/exceptions.py +0 -0
- {tesla_fleet_api-0.5.1 → tesla_fleet_api-0.5.3}/tesla_fleet_api/partner.py +0 -0
- {tesla_fleet_api-0.5.1 → tesla_fleet_api-0.5.3}/tesla_fleet_api/teslafleetoauth.py +0 -0
- {tesla_fleet_api-0.5.1 → tesla_fleet_api-0.5.3}/tesla_fleet_api/tessie.py +0 -0
- {tesla_fleet_api-0.5.1 → tesla_fleet_api-0.5.3}/tesla_fleet_api/user.py +0 -0
- {tesla_fleet_api-0.5.1 → tesla_fleet_api-0.5.3}/tesla_fleet_api/vehicle.py +0 -0
- {tesla_fleet_api-0.5.1 → tesla_fleet_api-0.5.3}/tesla_fleet_api/vehiclespecific.py +0 -0
- {tesla_fleet_api-0.5.1 → tesla_fleet_api-0.5.3}/tesla_fleet_api.egg-info/SOURCES.txt +0 -0
- {tesla_fleet_api-0.5.1 → tesla_fleet_api-0.5.3}/tesla_fleet_api.egg-info/dependency_links.txt +0 -0
- {tesla_fleet_api-0.5.1 → tesla_fleet_api-0.5.3}/tesla_fleet_api.egg-info/requires.txt +0 -0
- {tesla_fleet_api-0.5.1 → tesla_fleet_api-0.5.3}/tesla_fleet_api.egg-info/top_level.txt +0 -0
@@ -1,11 +1,11 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: tesla_fleet_api
|
3
|
-
Version: 0.5.
|
3
|
+
Version: 0.5.3
|
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
|
7
|
-
Author-email:
|
8
|
-
Classifier: Development Status ::
|
7
|
+
Author-email: admin@teslemetry.com
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
9
9
|
Classifier: Programming Language :: Python :: 3
|
10
10
|
Classifier: License :: OSI Approved :: Apache Software License
|
11
11
|
Classifier: Operating System :: OS Independent
|
@@ -5,16 +5,16 @@ with open("README.md", "r") as fh:
|
|
5
5
|
|
6
6
|
setuptools.setup(
|
7
7
|
name="tesla_fleet_api",
|
8
|
-
version="0.5.
|
8
|
+
version="0.5.3",
|
9
9
|
author="Brett Adams",
|
10
|
-
author_email="
|
10
|
+
author_email="admin@teslemetry.com",
|
11
11
|
description="Tesla Fleet API library for Python",
|
12
12
|
long_description=long_description,
|
13
13
|
long_description_content_type="text/markdown",
|
14
14
|
url="https://github.com/Teslemetry/tesla_fleet_api",
|
15
15
|
packages=setuptools.find_packages(),
|
16
16
|
classifiers=[
|
17
|
-
"Development Status ::
|
17
|
+
"Development Status :: 4 - Beta",
|
18
18
|
"Programming Language :: Python :: 3",
|
19
19
|
"License :: OSI Approved :: Apache Software License",
|
20
20
|
"Operating System :: OS Independent",
|
@@ -3,6 +3,14 @@
|
|
3
3
|
from enum import Enum
|
4
4
|
import logging
|
5
5
|
|
6
|
+
VERSION = "0.5.3"
|
7
|
+
LOGGER = logging.getLogger(__package__)
|
8
|
+
SERVERS = {
|
9
|
+
"na": "https://fleet-api.prd.na.vn.cloud.tesla.com",
|
10
|
+
"eu": "https://fleet-api.prd.eu.vn.cloud.tesla.com",
|
11
|
+
"cn": "https://fleet-api.prd.cn.vn.cloud.tesla.cn",
|
12
|
+
}
|
13
|
+
|
6
14
|
|
7
15
|
class IntEnum(int, Enum):
|
8
16
|
"""Integer Enum."""
|
@@ -20,15 +28,6 @@ class Method(StrEnum):
|
|
20
28
|
DELETE = "DELETE"
|
21
29
|
|
22
30
|
|
23
|
-
LOGGER = logging.getLogger(__package__)
|
24
|
-
|
25
|
-
SERVERS = {
|
26
|
-
"na": "https://fleet-api.prd.na.vn.cloud.tesla.com",
|
27
|
-
"eu": "https://fleet-api.prd.eu.vn.cloud.tesla.com",
|
28
|
-
"cn": "https://fleet-api.prd.cn.vn.cloud.tesla.cn",
|
29
|
-
}
|
30
|
-
|
31
|
-
|
32
31
|
class Trunk(StrEnum):
|
33
32
|
"""Trunk options"""
|
34
33
|
|
@@ -3,7 +3,7 @@ import aiohttp
|
|
3
3
|
from json import dumps
|
4
4
|
from .exceptions import raise_for_status, InvalidRegion, LibraryError, InvalidToken
|
5
5
|
from typing import Any
|
6
|
-
from .const import SERVERS, Method, LOGGER
|
6
|
+
from .const import SERVERS, Method, LOGGER, VERSION
|
7
7
|
from .charging import Charging
|
8
8
|
from .energy import Energy
|
9
9
|
from .partner import Partner
|
@@ -64,6 +64,7 @@ class TeslaFleetApi:
|
|
64
64
|
response = await (self.user.region()).get("response")
|
65
65
|
if response:
|
66
66
|
self.server = response["fleet_api_base_url"]
|
67
|
+
LOGGER.debug("Using server %s", self.server)
|
67
68
|
return response["region"]
|
68
69
|
except InvalidRegion:
|
69
70
|
continue
|
@@ -100,6 +101,7 @@ class TeslaFleetApi:
|
|
100
101
|
headers={
|
101
102
|
"Authorization": f"Bearer {self.access_token}",
|
102
103
|
"Content-Type": "application/json",
|
104
|
+
"X-Library": f"python tesla_fleet_api ${VERSION}",
|
103
105
|
},
|
104
106
|
json=json,
|
105
107
|
params=params,
|
@@ -2,7 +2,7 @@ import aiohttp
|
|
2
2
|
from aiolimiter import AsyncLimiter
|
3
3
|
from typing import Any
|
4
4
|
from .teslafleetapi import TeslaFleetApi
|
5
|
-
from .const import Method
|
5
|
+
from .const import Method, LOGGER
|
6
6
|
|
7
7
|
# Rate limit should be global, even if multiple instances are created
|
8
8
|
rate_limit = AsyncLimiter(5, 10)
|
@@ -26,30 +26,35 @@ class Teslemetry(TeslaFleetApi):
|
|
26
26
|
)
|
27
27
|
self.rate_limit = rate_limit
|
28
28
|
|
29
|
-
async def ping(self) -> bool:
|
29
|
+
async def ping(self) -> dict[str, bool]:
|
30
30
|
"""Send a ping."""
|
31
31
|
return await self._request(
|
32
32
|
Method.GET,
|
33
33
|
"api/ping",
|
34
34
|
)
|
35
35
|
|
36
|
-
async def test(self) -> bool:
|
36
|
+
async def test(self) -> dict[str, bool]:
|
37
37
|
"""Test API Authentication."""
|
38
38
|
return await self._request(
|
39
39
|
Method.GET,
|
40
40
|
"api/test",
|
41
41
|
)
|
42
42
|
|
43
|
-
async def metadata(self) ->
|
43
|
+
async def metadata(self, update_region=True) -> dict[str, Any]:
|
44
44
|
"""Test API Authentication."""
|
45
|
-
|
45
|
+
resp = await self._request(
|
46
46
|
Method.GET,
|
47
47
|
"api/metadata",
|
48
48
|
)
|
49
|
+
if update_region and "region" in resp:
|
50
|
+
self.region = resp["region"].lower()
|
51
|
+
self.server = f"https://{self.region}.teslemetry.com"
|
52
|
+
LOGGER.debug("Using server %s", self.server)
|
53
|
+
return resp
|
49
54
|
|
50
55
|
async def find_server(self):
|
51
56
|
"""Find the server URL for the Tesla Fleet API."""
|
52
|
-
|
57
|
+
await self.metadata(True)
|
53
58
|
|
54
59
|
async def _request(
|
55
60
|
self,
|
@@ -1,11 +1,11 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: tesla_fleet_api
|
3
|
-
Version: 0.5.
|
3
|
+
Version: 0.5.3
|
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
|
7
|
-
Author-email:
|
8
|
-
Classifier: Development Status ::
|
7
|
+
Author-email: admin@teslemetry.com
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
9
9
|
Classifier: Programming Language :: Python :: 3
|
10
10
|
Classifier: License :: OSI Approved :: Apache Software License
|
11
11
|
Classifier: Operating System :: OS Independent
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{tesla_fleet_api-0.5.1 → tesla_fleet_api-0.5.3}/tesla_fleet_api.egg-info/dependency_links.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|