From 30c5ce0ae4b5320e011cce3ff82074b65f98eddb Mon Sep 17 00:00:00 2001 From: arthur-lzrs <55158951+arthur-lzrs@users.noreply.github.com> Date: Thu, 12 Nov 2026 15:06:45 -0300 Subject: [PATCH] feat: add the MG Brazil (mg_br) configuration preset Adds SaicApiConfiguration.mg_br() for the "MG i-SMART LATAM" app: base URI https://gateway-mg-br.soimt.com/api.app/v1/, region br. Tenant ID and device app id keep the shared defaults, like the other MG presets. Login and the vehicle list were checked against a real MG4 Urban in Brazil (secondary account). The preset is added to the README table and to test_mg_presets. Co-Authored-By: Claude Sonnet 5.5 --- README.md | 1 + src/saic_ismart_client_ng/model.py | 8 ++++++++ tests/test_model.py | 1 + 3 files changed, 10 insertions(+) diff --git a/README.md b/README.md index f00a3d3..3dcb8eb 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ Presets are classmethods on `SaicApiConfiguration`. Each takes `(username, passw | `mg_eu()` | `https://gateway-mg-eu.soimt.com/api.app/v1/` | `eu` | `459771` | `com.saicmotor.europecar` | | `mg_au()` | `https://gateway-mg-au.soimt.com/api.app/v1/` | `au` | `459771` | `com.saicmotor.europecar` | | `mg_tr()` | `https://gateway-mg-tr.soimt.com/api.app/v1/` | `tr` | `459771` | `com.saicmotor.europecar` | +| `mg_br()` | `https://gateway-mg-br.soimt.com/api.app/v1/` | `br` | `459771` | `com.saicmotor.europecar` | | `maxus_eu()` | `https://gateway-maxus-eu.soimt.com/api.app/v1/` | `eu` | `590224` | `com.saicmaxus.ismarteu` | MAXUS Europe vehicles use the same API. The `maxus_eu()` values were confirmed by a live traffic capture of the MAXUS app. diff --git a/src/saic_ismart_client_ng/model.py b/src/saic_ismart_client_ng/model.py index 888a437..7cc8c4f 100644 --- a/src/saic_ismart_client_ng/model.py +++ b/src/saic_ismart_client_ng/model.py @@ -5,6 +5,7 @@ MG_EU_BASE_URI = "https://gateway-mg-eu.soimt.com/api.app/v1/" MG_AU_BASE_URI = "https://gateway-mg-au.soimt.com/api.app/v1/" MG_TR_BASE_URI = "https://gateway-mg-tr.soimt.com/api.app/v1/" +MG_BR_BASE_URI = "https://gateway-mg-br.soimt.com/api.app/v1/" MAXUS_EU_BASE_URI = "https://gateway-maxus-eu.soimt.com/api.app/v1/" MAXUS_EU_TENANT_ID = "590224" MAXUS_EU_DEVICE_APP_ID = "com.saicmaxus.ismarteu" @@ -57,6 +58,13 @@ def mg_tr(cls, username: str, password: str, **kwargs: Any) -> SaicApiConfigurat kwargs.setdefault("region", "tr") return cls(username, password, **kwargs) + @classmethod + def mg_br(cls, username: str, password: str, **kwargs: Any) -> SaicApiConfiguration: + """Build the configuration for MG iSMART in Brazil (the "MG i-SMART LATAM" app).""" + kwargs.setdefault("base_uri", MG_BR_BASE_URI) + kwargs.setdefault("region", "br") + return cls(username, password, **kwargs) + @classmethod def maxus_eu( cls, diff --git a/tests/test_model.py b/tests/test_model.py index 351f356..1715c9e 100644 --- a/tests/test_model.py +++ b/tests/test_model.py @@ -66,6 +66,7 @@ def test_mg_presets(self) -> None: (SaicApiConfiguration.mg_eu, "gateway-mg-eu", "eu"), (SaicApiConfiguration.mg_au, "gateway-mg-au", "au"), (SaicApiConfiguration.mg_tr, "gateway-mg-tr", "tr"), + (SaicApiConfiguration.mg_br, "gateway-mg-br", "br"), ): config = factory("u", "p") assert config.base_uri == f"https://{host}.soimt.com/api.app/v1/"