Private
Public Access
1
0

get_userid successful. Couldn't get workouts list to work

This commit is contained in:
Sander Roosendaal
2017-04-13 21:36:46 +02:00
parent 9c5ed87241
commit 9033cddbea

View File

@@ -171,8 +171,9 @@ def get_underarmour_workout_list(user):
headers = {'Authorization': authorizationstring,
'Api-Key': UNDERARMOUR_CLIENT_KEY,
'user-agent': 'sanderroosendaal',
'user':'v7.1/user/'+str(get_userid(r.underarmourtoken))+'/',
'Content-Type': 'application/json'}
url = "https://api.underarmour.com/fitnessActivities"
url = "https://api.ua.com/v7.1/workout/"
s = requests.get(url,headers=headers)
return s
@@ -190,7 +191,7 @@ def get_underarmour_workout(user,underarmourid):
'Api-Key': UNDERARMOUR_CLIENT_KEY,
'user-agent': 'sanderroosendaal',
'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)
return s
@@ -309,14 +310,13 @@ def get_userid(access_token):
'user-agent': 'sanderroosendaal',
'Content-Type': 'application/json'}
import urllib
url = "https://api.underarmour.com/user"
url = "https://api.ua.com/v7.1/user/self"
response = requests.get(url,headers=headers)
me_json = response.json()
try:
res = me_json['userID']
res = me_json['id']
except KeyError:
res = 0