Skip to content

Commit 2afc988

Browse files
committed
Make access_token optional in the case that OAuth is used.
1 parent 18ab593 commit 2afc988

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tesla_fleet_api/teslemetry/teslemetry.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,17 @@ class Teslemetry(TeslaFleetApi):
1414
def __init__(
1515
self,
1616
session: aiohttp.ClientSession,
17-
access_token: str,
17+
access_token: str = "",
1818
server: str = "https://api.teslemetry.com",
1919
refresh_hook: Callable[[], Awaitable[str | None]] | None = None,
2020
):
2121
"""Initialize the Teslemetry API."""
2222

23+
if not access_token and not refresh_hook:
24+
raise ValueError(
25+
"access_token or refresh_hook are required to authenticate"
26+
)
27+
2328
self.session = session
2429
self.access_token = access_token
2530
self.server = server

0 commit comments

Comments
 (0)