Private
Public Access
1
0

removing obsolete rowingdata(csvfile)

This commit is contained in:
Sander Roosendaal
2019-11-11 17:31:56 +01:00
parent 23909feabf
commit 2294603129
6 changed files with 152 additions and 156 deletions

View File

@@ -64,7 +64,7 @@ def get_token(code):
headers = {
'Content-Type': 'application/x-www-form-urlencoded',
}
response = requests.post("https://oauth.trainingpeaks.com/oauth/token",
data=post_data)
@@ -78,7 +78,7 @@ def get_token(code):
thetoken = 0
expires_in = 0
refresh_token = 0
return thetoken,expires_in,refresh_token
# Make authorization URL including random string
@@ -97,7 +97,7 @@ def getidfromresponse(response):
def createtpworkoutdata(w):
filename = w.csvfilename
row = rowingdata(filename)
row = rowingdata(csvfile=filename)
tcxfilename = filename[:-4]+'.tcx'
try:
newnotes = w.notes+'\n from '+w.workoutsource+' via rowsandall.com'
@@ -105,7 +105,7 @@ def createtpworkoutdata(w):
newnotes = 'from '+w.workoutsource+' via rowsandall.com'
row.exporttotcx(tcxfilename,notes=newnotes)
return tcxfilename
@@ -120,7 +120,7 @@ def tp_check(access_token):
headers=headers)
return resp
def uploadactivity(access_token,filename,description='',
name='Rowsandall.com workout'):
@@ -159,8 +159,8 @@ def uploadactivity(access_token,filename,description='',
return resp.json()[0]["Id"],"ok",200,""
return 0,0,0,0
def workout_tp_upload(user,w):
message = "Uploading to TrainingPeaks"
tpid = 0
@@ -169,7 +169,7 @@ def workout_tp_upload(user,w):
thetoken = tp_open(r.user)
# need some code if token doesn't refresh
if (checkworkoutuser(user,w)):
tcxfile = createtpworkoutdata(w)
@@ -205,5 +205,5 @@ def workout_tp_upload(user,w):
message = "You are not allowed to export this workout to TP"
tpid = 0
return message,tpid
return message,tpid