disable unused fct

This commit is contained in:
Florian Bezannier
2021-05-07 14:23:48 +02:00
parent c685c89cd1
commit 16645759e9
3 changed files with 3 additions and 34 deletions
-28
View File
@@ -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]
+3 -2
View File
@@ -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
-4
View File
@@ -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