diff --git a/connectedcar/api.py b/connectedcar/api.py index 1d17eb4..c269287 100644 --- a/connectedcar/api.py +++ b/connectedcar/api.py @@ -3,7 +3,7 @@ class Api(object): - def __init__(self, access_token, region): + def __init__(self, access_token, region, locale = 'en-US'): """ Initialize a new Api object to directly make requests to Ford. Args: @@ -18,6 +18,13 @@ def __init__(self, access_token, region): "AU": "5C80A6BB-CF0D-4A30-BDBF-FC804B5C1A98", # Australia } + countryCode = { + "US": "USA", # United States + "CA": "CAN", # Canada + "EU": "EUR", # Europe + "AU": "AUS", # Australia + } + self.access_token = access_token self.auth = { 'auth-token': access_token, @@ -26,7 +33,9 @@ def __init__(self, access_token, region): 'User-Agent': 'FordPass/5 CFNetwork/1333.0.4 Darwin/21.5.0', 'Content-Type': 'application/json', 'Accept-Encoding': 'gzip, deflate, br', - 'Application-Id': regions[region] + 'Application-Id': regions[region], + 'countryCode': countryCode[region], + 'locale': locale } def _format(self, endpoint, context): diff --git a/connectedcar/user.py b/connectedcar/user.py index 431b839..247a0b3 100644 --- a/connectedcar/user.py +++ b/connectedcar/user.py @@ -36,17 +36,20 @@ def get_messages(self): return response.json() def vehicles(self): - """ GET User.vehicles + """ POST User.vehicles Returns: Response: User vehicle list """ - response = self.api.get( + data = '{"dashboardRefreshRequest": "All", "smsWakeUpVIN": ""}' + response = self.api.post( const.USER_URL, - 'users/vehicles') - return response.json()['vehicles']['$values'] + 'expdashboard/v1/details', data) + + print(response) + return response.json()['userVehicles']['vehicleDetails'] def add_vehicle(self, vehicle_id): """ POST User.add_vehicle