Skip to content

Commit 91b2603

Browse files
committed
no-mistakes(review): Warn on deprecated alias use, document raw param and public parser
1 parent a000b24 commit 91b2603

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

docs/teslemetry.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,13 @@ an unrecognized response shape raises
559559
never mistaken for "no authorized clients". The raw response is still
560560
available on `raw` for anything not modeled.
561561

562+
`find_authorized_clients(raw=True)` skips the typed parse and returns the
563+
exact response `list_authorized_clients()` would, matching the call shape of
564+
a local gateway path that also wants to opt out of typing. The parsing itself
565+
lives in the module-level `tesla_fleet_api.teslemetry.energysite.parse_authorized_clients`
566+
function, which other callers (e.g. a local/LAN client using the same
567+
envelope shape) can reuse directly to get the same `AuthorizedClients` result.
568+
562569
`remove_authorized_client(public_key)` accepts raw DER bytes or an already
563570
base64-encoded key string. Removal requires no physical presence proof, so any
564571
paired key can revoke every other key, including the owner's.

tesla_fleet_api/teslemetry/energysite.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import re
66
import socket
77
import struct
8+
import warnings
89
from collections.abc import Awaitable, Callable
910
from dataclasses import dataclass
1011
from typing import Any, Literal, overload, cast
@@ -207,8 +208,16 @@ def parse_authorized_clients(payload: Any) -> AuthorizedClients:
207208
return AuthorizedClients(clients=clients, raw=payload)
208209

209210

210-
# Deprecated alias, kept for one release.
211-
_parse_authorized_clients = parse_authorized_clients
211+
def _parse_authorized_clients( # pyright: ignore[reportUnusedFunction]
212+
payload: Any,
213+
) -> AuthorizedClients:
214+
"""Deprecated alias for :func:`parse_authorized_clients`, kept for one release."""
215+
warnings.warn(
216+
"_parse_authorized_clients is deprecated; use parse_authorized_clients instead.",
217+
DeprecationWarning,
218+
stacklevel=2,
219+
)
220+
return parse_authorized_clients(payload)
212221

213222

214223
_GATEWAY_INTERFACES = ("eth", "wifi")

0 commit comments

Comments
 (0)