From 4f6c2f8d56a83a6aafcce94fa500598031974ff2 Mon Sep 17 00:00:00 2001 From: Florian Bezannier Date: Wed, 16 Jun 2021 15:08:20 +0200 Subject: [PATCH] some fix --- Dockerfile | 2 +- app_decoder.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6e985a2..22223a9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,5 +4,5 @@ WORKDIR /config RUN pip3 install --no-cache-dir -r /psa_car_controller/requirements.txt EXPOSE 5000 RUN chmod +x /psa_car_controller/docker_files/init.sh -ENV PSACC_BASE_PATH=/ PSACC_PORT=5000 PSACC_OPTIONS="-c -r -d --web-conf" PSACC_CONFIG_DIR="/config" +ENV PSACC_BASE_PATH=/ PSACC_PORT=5000 PSACC_OPTIONS="-c -r --web-conf" PSACC_CONFIG_DIR="/config" CMD /psa_car_controller/docker_files/init.sh diff --git a/app_decoder.py b/app_decoder.py index 752f659..ecd34b5 100755 --- a/app_decoder.py +++ b/app_decoder.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 import json +import logging import os import traceback from urllib import request @@ -13,6 +14,7 @@ from cryptography.hazmat.backends import default_backend from charge_control import ChargeControl, ChargeControls from my_psacc import MyPSACC +from mylogger import logger BRAND = {"com.psa.mym.myopel": {"realm": "clientsB2COpel", "brand_code": "OP", "app_name": "MyOpel"}, "com.psa.mym.mypeugeot": {"realm": "clientsB2CPeugeot", "brand_code": "AP", "app_name": "MyPeugeot"}, @@ -54,6 +56,8 @@ def firstLaunchConfig(package_name, client_email, client_password, country_code, REMOTE_REFRESH_TOKEN = None ## Get Customer id site_code = BRAND[package_name]["brand_code"] + "_" + country_code + "_ESP" + pfx_cert = a.get_file("assets/MWPMYMA1.pfx") + save_key_to_pem(pfx_cert, "") try: res = requests.post(HOST_BRANDID_PROD + "/GetAccessToken", headers={ @@ -77,7 +81,6 @@ def firstLaunchConfig(package_name, client_email, client_password, country_code, except: pass raise Exception(msg) - try: res2 = requests.post( f"https://mw-{BRAND[package_name]['brand_code'].lower()}-m2c.mym.awsmpsa.com/api/v1/" @@ -102,6 +105,7 @@ def firstLaunchConfig(package_name, client_email, client_password, country_code, msg += res2.text except: pass + logging.error(msg) Exception(msg) # Psacc