diff --git a/rowers/polarstuff.py b/rowers/polarstuff.py index 65ac068d..27deba7b 100644 --- a/rowers/polarstuff.py +++ b/rowers/polarstuff.py @@ -137,7 +137,7 @@ def get_polar_workout_list(user): return response -def get_polar_user_info(user): +def get_polar_user_info(user,physical=False): r = Rower.objects.get(user=user) if (r.polartoken == '') or (r.polartoken is None): s = "Token doesn't exist. Need to authorize" @@ -156,13 +156,22 @@ def get_polar_user_info(user): 'user-id': r.polaruserid } - url = 'https://polaraccesslink.com/v3/users/{userid}'.format( - userid = r.polaruserid + if not physical: + url = 'https://polaraccesslink.com/v3/users/{userid}'.format( + userid = r.polaruserid ) + else: + url = 'https://www.polaraccesslink.com/v3/users/{userid}/physical-information-transactions/'.format( + userid = r.polaruserid + ) print url - response = requests.get(url, headers=headers) + + if physical: + response = requests.post(url, headers=headers) + else: + response = requests.get(url, headers=headers) return response