Skip to content

Commit

Permalink
Update user vehicles endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian committed Oct 25, 2022
1 parent 353ec90 commit e70a527
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
13 changes: 11 additions & 2 deletions connectedcar/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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,
Expand All @@ -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):
Expand Down
11 changes: 7 additions & 4 deletions connectedcar/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e70a527

Please sign in to comment.