diff --git a/app_decoder.py b/app_decoder.py index 8994a69..a776322 100755 --- a/app_decoder.py +++ b/app_decoder.py @@ -4,7 +4,6 @@ import os import traceback from sys import argv import sys -import re from getpass import getpass from androguard.core.bytecodes.apk import APK @@ -25,33 +24,6 @@ BRAND = {"com.psa.mym.myopel": {"realm": "clientsB2COpel", "brand_code": "OP", " } -def getxmlvalue(root, name): - for child in root.findall("*[@name='" + name + "']"): - return child.text - - -def find_app_path(): - base_dir = 'apps/' - paths = os.listdir(base_dir) - if len(paths) > 0: - for path in paths: - pattern = re.compile('com.psa.mym.\\w*') - print(pattern.match(path)) - if pattern.match(path) is not None: - return base_dir + path - return None - - -def find_preferences_xml(): - paths = os.listdir() - if len(paths) > 0: - for path in paths: - pattern = re.compile('com.psa.mym.\\w*_preferences.xml') - if pattern.match(path) is not None: - return path - return None - - def save_key_to_pem(pfx_data, pfx_password): private_key, certificate = pkcs12.load_key_and_certificates(pfx_data, bytes.fromhex(pfx_password), default_backend())[:2] diff --git a/my_psacc.py b/my_psacc.py index d0a3149..fa38829 100644 --- a/my_psacc.py +++ b/my_psacc.py @@ -10,6 +10,7 @@ from time import sleep from oauth2_client.credentials_manager import ServiceInformation import paho.mqtt.client as mqtt from requests.exceptions import RequestException +from urllib3.exceptions import InvalidHeader import psa_connectedcar as psac from libs.car import Cars, Car @@ -143,7 +144,7 @@ class MyPSACC: if self._record_enabled: self.record_info(car) return res - except ApiException as ex: + except (ApiException, InvalidHeader) as ex: logger.error("get_vehicle_info: ApiException: %s", ex) logger.debug(exc_info=True) car.status = res @@ -173,7 +174,7 @@ class MyPSACC: for vehicle in res.embedded.vehicles: self.vehicles_list.add(Car(vehicle.vin, vehicle.id, vehicle.brand, vehicle.label)) self.vehicles_list.save_cars() - except ApiException: + except (ApiException, InvalidHeader): logger.exception("get_vehicles:") return self.vehicles_list diff --git a/web/db.py b/web/db.py index 50580ba..b65eabe 100644 --- a/web/db.py +++ b/web/db.py @@ -63,10 +63,6 @@ class Database: def convert_datetime_to_string(date: datetime): return date.replace(tzinfo=pytz.UTC).isoformat(timespec='seconds', sep=" ") - @staticmethod - def update_callback(): - Database.callback_fct() - @staticmethod def set_db_callback(callbackfct): Database.callback_fct = callbackfct