diff --git a/rowers/c2stuff.py b/rowers/c2stuff.py index c9ce31e9..379d7500 100644 --- a/rowers/c2stuff.py +++ b/rowers/c2stuff.py @@ -167,6 +167,8 @@ def get_c2_workouts(rower): res = get_c2_workout_list(rower.user,page=1) if (res.status_code != 200): + with open('c2_auto_import.log') as logfile: + logfile.write('Status code != 200\n') return 0 else: c2ids = [item['id'] for item in res.json()['data']] @@ -804,9 +806,14 @@ 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" + with open('c2_auto_import.log') as logfile: + logfile.write('get_c2_workout_list - token does not exist\n') return custom_exception_handler(401,s) elif (timezone.now()>r.tokenexpirydate): s = "Token expired. Needs to refresh." + with open('c2_auto_import.log') as logfile: + logfile.write('get_c2_workout_list - token expires\n') + return custom_exception_handler(401,s) else: # ready to fetch. Hurray