Skip to content

Commit

Permalink
Rename proxyCert to verifyCert
Browse files Browse the repository at this point in the history
  • Loading branch information
RichieB2B committed Jan 24, 2024
1 parent 8d412ad commit 1d0e03f
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lib/TWCManager/Vehicle/TeslaAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class TeslaAPI:
'CN': 'https://fleet-api.prd.cn.vn.cloud.tesla.cn/api/1/vehicles',
}
refreshClientID = "ownerapi"
proxyCert = True
verifyCert = True
carApiLastErrorTime = 0
carApiBearerToken = ""
carApiRefreshToken = ""
Expand Down Expand Up @@ -75,7 +75,7 @@ def __init__(self, master):
proxyURL = self.config["config"].get("teslaProxy", "")
if proxyURL:
self.baseURL = proxyURL + "/api/1/vehicles"
self.proxyCert = self.config["config"].get("teslaProxyCert", True)
self.verifyCert = self.config["config"].get("teslaProxyCert", True)
self.refreshClientID = self.config["config"].get(
"teslaApiClientID", "ownerapi"
)
Expand Down Expand Up @@ -242,7 +242,7 @@ def car_api_available(
"Authorization": "Bearer " + self.getCarApiBearerToken(),
}
try:
req = requests.get(url, headers=headers, verify=self.proxyCert)
req = requests.get(url, headers=headers, verify=self.verifyCert)
logger.log(logging.INFO8, "Car API cmd vehicles " + str(req))
apiResponseDict = json.loads(req.text)
except requests.exceptions.RequestException:
Expand Down Expand Up @@ -666,7 +666,7 @@ def car_api_charge(self, charge):
# Retry up to 3 times on certain errors.
for _ in range(0, 3):
try:
req = requests.post(url, headers=headers, verify=self.proxyCert)
req = requests.post(url, headers=headers, verify=self.verifyCert)
logger.log(
logging.INFO8,
"Car API cmd charge_" + startOrStop + " " + str(req),
Expand Down Expand Up @@ -1150,7 +1150,7 @@ def setChargeRate(self, charge_rate, vehicle=None, set_again=False):
body = {"charging_amps": charge_rate}

try:
req = requests.post(url, headers=headers, json=body, verify=self.proxyCert)
req = requests.post(url, headers=headers, json=body, verify=self.verifyCert)
logger.log(
logging.INFO8,
f"Car API cmd set_charging_amps {charge_rate}A {str(req)}",
Expand Down Expand Up @@ -1208,7 +1208,7 @@ def wakeVehicle(self, vehicle):
"Authorization": "Bearer " + self.getCarApiBearerToken(),
}
try:
req = requests.post(url, headers=headers, verify=self.proxyCert)
req = requests.post(url, headers=headers, verify=self.verifyCert)
logger.log(logging.INFO8, "Car API cmd wake_up" + str(req))
apiResponseDict = json.loads(req.text)
except requests.exceptions.RequestException:
Expand Down Expand Up @@ -1236,7 +1236,7 @@ class CarApiVehicle:
carapi = None
__config = None
debuglevel = 0
proxyCert = None
verifyCert = None
ID = None
name = ""
syncSource = "TeslaAPI"
Expand Down Expand Up @@ -1270,7 +1270,7 @@ class CarApiVehicle:
def __init__(self, json, carapi, config):
self.carapi = carapi
self.__config = config
self.proxyCert = config["config"].get("teslaProxyCert", True)
self.verifyCert = config["config"].get("teslaProxyCert", True)
self.ID = json["id"]
self.VIN = json["vin"]
self.name = json["display_name"]
Expand Down Expand Up @@ -1367,7 +1367,7 @@ def get_car_api(self, url, checkReady=True, provesOnline=True):
# Retry up to 3 times on certain errors.
for _ in range(0, 3):
try:
req = requests.get(url, headers=headers, verify=self.proxyCert)
req = requests.get(url, headers=headers, verify=self.verifyCert)
logger.log(logging.INFO8, "Car API cmd " + url + " " + str(req))
apiResponseDict = json.loads(req.text)
# This error can happen here as well:
Expand Down Expand Up @@ -1495,7 +1495,7 @@ def apply_charge_limit(self, limit):
for _ in range(0, 3):
try:
req = requests.post(
url, headers=headers, json=body, verify=self.proxyCert
url, headers=headers, json=body, verify=self.verifyCert
)
logger.log(logging.INFO8, "Car API cmd set_charge_limit " + str(req))

Expand Down

0 comments on commit 1d0e03f

Please sign in to comment.