mirror of
https://github.com/flobz/psa_car_controller.git
synced 2026-08-22 01:16:14 +00:00
The "op" in "mym**op**" stands for Opel 😅 🤦
This commit is contained in:
@@ -35,8 +35,8 @@ class OpenIdCredentialManager(CredentialManager):
|
||||
challenge = encoded.decode('ascii')[:-1]
|
||||
return verifier, challenge
|
||||
|
||||
def init_with_country_code(self, country_code: str):
|
||||
redir_uri = "mymop://oauth2redirect/" + country_code.lower()
|
||||
def init_with_brand_country_code(self, brand: str, country_code: str):
|
||||
redir_uri = "mym" + brand.lower() + "://oauth2redirect/" + country_code.lower()
|
||||
code_verifier, code_challenge = self.generate_sha256_pkce(64)
|
||||
url = self.generate_authorize_url(redir_uri, secrets.token_urlsafe(16),
|
||||
code_challenge=code_challenge, code_challenge_method="S256")
|
||||
|
||||
@@ -91,8 +91,8 @@ def firstLaunchConfig(package_name, client_email, client_password, country_code,
|
||||
# Psacc
|
||||
psacc = PSAClient(None, apk_parser.client_id, apk_parser.client_secret,
|
||||
None, customer_id, BRAND[package_name]["realm"],
|
||||
country_code)
|
||||
psacc.connect(country_code)
|
||||
country_code, BRAND[package_name]["brand_code"])
|
||||
psacc.connect()
|
||||
psacc.save_config(name=config_prefix + "config.json")
|
||||
res = psacc.get_vehicles()
|
||||
|
||||
|
||||
@@ -31,12 +31,12 @@ logger = CustomLogger.getLogger(__name__)
|
||||
|
||||
|
||||
class PSAClient:
|
||||
def connect(self, country_code):
|
||||
self.manager.init_with_country_code(country_code)
|
||||
def connect(self):
|
||||
self.manager.init_with_brand_country_code(self.brand, self.country_code)
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
def __init__(self, refresh_token, client_id, client_secret, remote_refresh_token, customer_id, realm, country_code,
|
||||
proxies=None, weather_api=None, abrp=None, co2_signal_api=None):
|
||||
brand=None, proxies=None, weather_api=None, abrp=None, co2_signal_api=None):
|
||||
self.realm = realm
|
||||
self.service_information = ServiceInformation(AUTHORIZE_SERVICE[self.realm],
|
||||
realm_info[self.realm]['oauth_url'],
|
||||
@@ -60,6 +60,7 @@ class PSAClient:
|
||||
self._record_enabled = False
|
||||
self.weather_api = weather_api
|
||||
self.country_code = country_code
|
||||
self.brand = brand
|
||||
self.info_callback = []
|
||||
self.info_refresh_rate = 120
|
||||
if abrp is None:
|
||||
|
||||
Reference in New Issue
Block a user