get_userid successful. Couldn't get workouts list to work
This commit is contained in:
@@ -171,8 +171,9 @@ def get_underarmour_workout_list(user):
|
|||||||
headers = {'Authorization': authorizationstring,
|
headers = {'Authorization': authorizationstring,
|
||||||
'Api-Key': UNDERARMOUR_CLIENT_KEY,
|
'Api-Key': UNDERARMOUR_CLIENT_KEY,
|
||||||
'user-agent': 'sanderroosendaal',
|
'user-agent': 'sanderroosendaal',
|
||||||
|
'user':'v7.1/user/'+str(get_userid(r.underarmourtoken))+'/',
|
||||||
'Content-Type': 'application/json'}
|
'Content-Type': 'application/json'}
|
||||||
url = "https://api.underarmour.com/fitnessActivities"
|
url = "https://api.ua.com/v7.1/workout/"
|
||||||
s = requests.get(url,headers=headers)
|
s = requests.get(url,headers=headers)
|
||||||
|
|
||||||
return s
|
return s
|
||||||
@@ -190,7 +191,7 @@ def get_underarmour_workout(user,underarmourid):
|
|||||||
'Api-Key': UNDERARMOUR_CLIENT_KEY,
|
'Api-Key': UNDERARMOUR_CLIENT_KEY,
|
||||||
'user-agent': 'sanderroosendaal',
|
'user-agent': 'sanderroosendaal',
|
||||||
'Content-Type': 'application/json'}
|
'Content-Type': 'application/json'}
|
||||||
url = "https://api.underarmour.com/fitnessActivities/"+str(underarmourid)
|
url = "https://api.ua.com/v7.1/workout/"+str(underarmourid)+"/"
|
||||||
s = requests.get(url,headers=headers)
|
s = requests.get(url,headers=headers)
|
||||||
|
|
||||||
return s
|
return s
|
||||||
@@ -309,14 +310,13 @@ def get_userid(access_token):
|
|||||||
'user-agent': 'sanderroosendaal',
|
'user-agent': 'sanderroosendaal',
|
||||||
'Content-Type': 'application/json'}
|
'Content-Type': 'application/json'}
|
||||||
import urllib
|
import urllib
|
||||||
url = "https://api.underarmour.com/user"
|
url = "https://api.ua.com/v7.1/user/self"
|
||||||
response = requests.get(url,headers=headers)
|
response = requests.get(url,headers=headers)
|
||||||
|
|
||||||
|
|
||||||
me_json = response.json()
|
me_json = response.json()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
res = me_json['userID']
|
res = me_json['id']
|
||||||
except KeyError:
|
except KeyError:
|
||||||
res = 0
|
res = 0
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user