mirror of
https://github.com/flobz/psa_car_controller.git
synced 2026-08-21 17:06:18 +00:00
feat: migrate to dash 4.0 and add timeout for all requests
This commit is contained in:
committed by
Florian BEZANNIER
parent
e505a2a163
commit
90bc4a25f1
Generated
+3253
File diff suppressed because it is too large
Load Diff
@@ -175,7 +175,7 @@ class RemoteClient:
|
||||
res = self.manager.post(REMOTE_URL + self.account_info.client_id,
|
||||
json={"grant_type": "refresh_token",
|
||||
"refresh_token": self.remoteCredentials.refresh_token},
|
||||
headers=self.headers)
|
||||
headers=self.headers, timeout=TIMEOUT_IN_S)
|
||||
data = res.json()
|
||||
logger.debug("refresh_remote_token: %s", data)
|
||||
if "access_token" in data:
|
||||
@@ -202,7 +202,7 @@ class RemoteClient:
|
||||
def get_sms_otp_code(self):
|
||||
res = self.manager.post(
|
||||
"https://api.groupe-psa.com/applications/cvs/v4/mobile/smsCode?client_id=" + self.account_info.client_id,
|
||||
headers=self.headers)
|
||||
headers=self.headers, timeout=TIMEOUT_IN_S)
|
||||
return res
|
||||
|
||||
# 6 otp by day
|
||||
@@ -220,7 +220,7 @@ class RemoteClient:
|
||||
def _get_remote_access_token(self, password):
|
||||
res = self.manager.post(REMOTE_URL + self.account_info.client_id,
|
||||
json={"grant_type": "password", "password": password},
|
||||
headers=self.headers)
|
||||
headers=self.headers, timeout=TIMEOUT_IN_S)
|
||||
data = res.json()
|
||||
try:
|
||||
self.remoteCredentials.access_token = data["access_token"]
|
||||
|
||||
@@ -138,8 +138,8 @@ class ElectricityPriceConfig(BaseModel):
|
||||
date = date + timedelta(minutes=30)
|
||||
try:
|
||||
res = round(consumption * mean(prices) / self.charger_efficiency, 2)
|
||||
except (TypeError, StatisticsError):
|
||||
logger.error("Can't get_price of charge, check config")
|
||||
except (TypeError, StatisticsError) as e:
|
||||
logger.error("Can't get_price of charge, check config", exc_info=e)
|
||||
return res
|
||||
|
||||
def get_price(self, charge: Charge, battery_charge_curves: List[BatteryChargeCurve]):
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
display: none;
|
||||
}
|
||||
|
||||
div.export-load-anim div.dash-sk-circle {
|
||||
div.export-load-anim .dash-loading-spinner {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
+2
-2
@@ -13,8 +13,8 @@ include = [
|
||||
[tool.poetry.dependencies]
|
||||
python = ">=3.11, <4.0.0"
|
||||
paho-mqtt = ">=1.5.0, <2.0.0"
|
||||
dash = ">=2.9.0, <3.0.0"
|
||||
dash-daq = "^0.5.0"
|
||||
dash = ">=4.0.0, <5.0.0"
|
||||
dash-daq = "^0.6.0"
|
||||
plotly = ">=5"
|
||||
cryptography = ">=2.6"
|
||||
Werkzeug = ">=1.0.0"
|
||||
|
||||
Reference in New Issue
Block a user