From 48c32dbf6dd91a3a037b91b16c2dd156281379fe Mon Sep 17 00:00:00 2001 From: tibor19 Date: Wed, 5 Jul 2023 01:06:48 +0200 Subject: [PATCH] Added support for Lexus --- README.md | 4 ++-- mytoyota/client.py | 4 +++- mytoyota/const.py | 1 - mytoyota/controller.py | 3 +++ 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 744c9840..960c9d1b 100644 --- a/README.md +++ b/README.md @@ -30,13 +30,13 @@ from mytoyota.client import MyT username = "jane@doe.com" password = "MyPassword" +brand = "toyota" # or lexus # Get supported regions, can be passed to the optional 'region' argument of MyT # At this moment, only the 'europe' region is supported print(MyT.get_supported_regions()) -client = MyT(username=username, password=password) - +client = MyT(username=username, password=password, brand=brand) async def get_information(): print("Logging in...") diff --git a/mytoyota/client.py b/mytoyota/client.py index 3a4fecee..2a8daf02 100644 --- a/mytoyota/client.py +++ b/mytoyota/client.py @@ -63,7 +63,8 @@ def __init__( password: str, locale: str = "da-dk", region: str = "europe", - uuid: str = None, + brand: str = "toyota", + uuid: str | None = None, controller_class=Controller, disable_locale_check: bool = False, ) -> None: @@ -87,6 +88,7 @@ def __init__( password=password, locale=locale, region=region, + brand=brand, uuid=uuid, ) ) diff --git a/mytoyota/const.py b/mytoyota/const.py index a43d7587..043d0089 100644 --- a/mytoyota/const.py +++ b/mytoyota/const.py @@ -61,7 +61,6 @@ "Content-Type": "application/json;charset=UTF-8", "Accept": "application/json, text/plain, */*", "Sec-Fetch-Dest": "empty", - "X-TME-BRAND": "TOYOTA", "User-Agent": ( "Mozilla/5.0 (X11; Linux x86_64) " "AppleWebKit/537.36 (KHTML, like Gecko) " diff --git a/mytoyota/controller.py b/mytoyota/controller.py index a5870adf..87ff3604 100644 --- a/mytoyota/controller.py +++ b/mytoyota/controller.py @@ -43,12 +43,14 @@ def __init__( region: str, username: str, password: str, + brand: str, uuid: str | None = None, ) -> None: self._locale = locale self._region = region self._username = username self._password = password + self._brand = brand self._uuid = uuid @property @@ -176,6 +178,7 @@ async def request( # pylint: disable=too-many-branches "X-TME-LOCALE": self._locale, "X-TME-TOKEN": self._token, "X-TME-APP-VERSION": "4.10.0", + "X-TME-BRAND": self._brand.upper(), } )