Private
Public Access
1
0

imports more than 50 workouts from C2

This commit is contained in:
Sander Roosendaal
2017-11-14 21:49:53 -06:00
parent 8f3c59fa2f
commit ffd2abc815
5 changed files with 29 additions and 10 deletions

View File

@@ -484,7 +484,7 @@ def get_c2_workout_strokes(user,c2id):
# Get list of C2 workouts. We load only the first page,
# assuming that users don't want to import their old workouts
def get_c2_workout_list(user):
def get_c2_workout_list(user,page=1):
r = Rower.objects.get(user=user)
if (r.c2token == '') or (r.c2token is None):
s = "Token doesn't exist. Need to authorize"
@@ -499,6 +499,8 @@ def get_c2_workout_list(user):
'user-agent': 'sanderroosendaal',
'Content-Type': 'application/json'}
url = "https://log.concept2.com/api/users/me/results"
url += "?page={page}".format(page=page)
s = requests.get(url,headers=headers)
return s