Skip to content

Commit

Permalink
v0.5.16
Browse files Browse the repository at this point in the history
  • Loading branch information
Bre77 committed Jun 1, 2024
1 parent 4dc7dab commit df2d9a6
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 9 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="tesla_fleet_api",
version="0.5.15",
version="0.5.16",
author="Brett Adams",
author_email="hello@teslemetry.com",
description="Tesla Fleet API library for Python",
Expand Down
2 changes: 1 addition & 1 deletion tesla_fleet_api/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from enum import Enum
import logging

VERSION = "0.5.15"
VERSION = "0.5.16"
LOGGER = logging.getLogger(__package__)
SERVERS = {
"na": "https://fleet-api.prd.na.vn.cloud.tesla.com",
Expand Down
38 changes: 31 additions & 7 deletions tesla_fleet_api/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,22 +78,44 @@ class MobileAccessDisabled(TeslaFleetError):
key = "mobile_access_disabled"


class MissingToken(TeslaFleetError): # Teslemetry specific
"""Teslemetry specific error when no access token is provided."""
class MissingToken(TeslaFleetError):
"""Third party specific error when no access token is provided."""

message = "Missing access token."
status = 401


class MissingTeslemetryToken(MissingToken):
"""Teslemetry specific error when no access token is provided."""

key = "missing_token"


class InvalidToken(TeslaFleetError): # Teslemetry specific
"""Teslemetry specific error for invalid access token."""
class MissingTessieToken(MissingToken):
"""Tessie specific error when no access token is provided."""

key = "Access token is required"


message = "Invalid Teslemetry access token."
class InvalidToken(TeslaFleetError):
"""Third party specific error for invalid access token."""

message = "Invalid access token."
status = 401


class InvalidTeslemetryToken(InvalidToken):
"""Teslemetry specific error for invalid access token."""

key = "invalid_token"


class InvalidTessieToken(InvalidToken):
"""Tessie specific error for invalid access token."""

key = "Invalid access token"


class OAuthExpired(TeslaFleetError):
"""The OAuth token has expired."""

Expand Down Expand Up @@ -301,8 +323,10 @@ async def raise_for_status(resp: aiohttp.ClientResponse) -> None:
OAuthExpired,
MobileAccessDisabled,
LoginRequired,
MissingToken,
InvalidToken,
MissingTeslemetryToken,
MissingTessieToken,
InvalidTeslemetryToken,
InvalidTessieToken,
]:
if error == exception.key:
raise exception(data)
Expand Down

0 comments on commit df2d9a6

Please sign in to comment.