trainingpeaks to production
This commit is contained in:
@@ -406,7 +406,6 @@ class Workout(models.Model):
|
|||||||
uploadedtounderarmour = models.IntegerField(default=0)
|
uploadedtounderarmour = models.IntegerField(default=0)
|
||||||
uploadedtotp = models.IntegerField(default=0)
|
uploadedtotp = models.IntegerField(default=0)
|
||||||
uploadedtorunkeeper = models.IntegerField(default=0)
|
uploadedtorunkeeper = models.IntegerField(default=0)
|
||||||
runkeeperuri = models.CharField(default='',max_length=200)
|
|
||||||
|
|
||||||
# empower stuff
|
# empower stuff
|
||||||
inboard = models.FloatField(default=0.88)
|
inboard = models.FloatField(default=0.88)
|
||||||
|
|||||||
@@ -356,7 +356,6 @@ def workout_runkeeper_upload(user,w):
|
|||||||
rkid = getidfromresponse(response)
|
rkid = getidfromresponse(response)
|
||||||
rkuri = geturifromid(thetoken,rkid)
|
rkuri = geturifromid(thetoken,rkid)
|
||||||
w.uploadedtorunkeeper = rkid
|
w.uploadedtorunkeeper = rkid
|
||||||
w.runkeeperuri = rkuri
|
|
||||||
w.save()
|
w.save()
|
||||||
return '',rkid
|
return '',rkid
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -142,7 +142,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="grid_1">
|
<div class="grid_1">
|
||||||
<a href="https://app.sandbox.trainingpeaks.com">
|
<a href="https://app.trainingpeaks.com">
|
||||||
<img src="/static/img/tpchecked.png" alt="TrainingPeaks icon" width="60" height="60"></a>
|
<img src="/static/img/tpchecked.png" alt="TrainingPeaks icon" width="60" height="60"></a>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ from rowsandall_app.settings import (
|
|||||||
TP_REDIRECT_URI,TP_CLIENT_KEY,
|
TP_REDIRECT_URI,TP_CLIENT_KEY,
|
||||||
)
|
)
|
||||||
|
|
||||||
tpapilocation = "https://api.sandbox.trainingpeaks.com"
|
tpapilocation = "https://api.trainingpeaks.com"
|
||||||
|
|
||||||
# Custom error class - to raise a NoTokenError
|
# Custom error class - to raise a NoTokenError
|
||||||
class TPNoTokenError(Exception):
|
class TPNoTokenError(Exception):
|
||||||
@@ -107,7 +107,7 @@ def do_refresh_token(refreshtoken):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
url = "https://oauth.sandbox.trainingpeaks.com/oauth/token"
|
url = "https://oauth.trainingpeaks.com/oauth/token"
|
||||||
|
|
||||||
response = requests.post(url,
|
response = requests.post(url,
|
||||||
data=post_data,
|
data=post_data,
|
||||||
@@ -141,7 +141,7 @@ def get_token(code):
|
|||||||
'Content-Type': 'application/x-www-form-urlencoded',
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
}
|
}
|
||||||
|
|
||||||
response = requests.post("https://oauth.sandbox.trainingpeaks.com/oauth/token",
|
response = requests.post("https://oauth.trainingpeaks.com/oauth/token",
|
||||||
data=post_data)
|
data=post_data)
|
||||||
|
|
||||||
|
|
||||||
@@ -167,7 +167,7 @@ def make_authorization_url(request):
|
|||||||
"redirect_uri": TP_REDIRECT_URI,
|
"redirect_uri": TP_REDIRECT_URI,
|
||||||
"scope": "file:write",
|
"scope": "file:write",
|
||||||
}
|
}
|
||||||
url = "https://oauth.sandbox.trainingpeaks.com/oauth/authorize?" +urllib.urlencode(params)
|
url = "https://oauth.trainingpeaks.com/oauth/authorize?" +urllib.urlencode(params)
|
||||||
|
|
||||||
return HttpResponseRedirect(url)
|
return HttpResponseRedirect(url)
|
||||||
|
|
||||||
|
|||||||
@@ -1654,7 +1654,7 @@ def rower_tp_authorize(request):
|
|||||||
"redirect_uri": TP_REDIRECT_URI,
|
"redirect_uri": TP_REDIRECT_URI,
|
||||||
"scope": "file:write",
|
"scope": "file:write",
|
||||||
}
|
}
|
||||||
url = "https://oauth.sandbox.trainingpeaks.com/oauth/authorize/?" +urllib.urlencode(params)
|
url = "https://oauth.trainingpeaks.com/oauth/authorize/?" +urllib.urlencode(params)
|
||||||
|
|
||||||
return HttpResponseRedirect(url)
|
return HttpResponseRedirect(url)
|
||||||
|
|
||||||
@@ -5508,7 +5508,6 @@ def workout_getrunkeeperworkout_view(request,runkeeperid):
|
|||||||
w = Workout.objects.get(id=id)
|
w = Workout.objects.get(id=id)
|
||||||
w.uploadedtorunkeeper=runkeeperid
|
w.uploadedtorunkeeper=runkeeperid
|
||||||
thetoken = runkeeper_open(request.user)
|
thetoken = runkeeper_open(request.user)
|
||||||
w.runkeeperuri = runkeeperstuff.geturifromid(thetoken,runkeeperid)
|
|
||||||
w.save()
|
w.save()
|
||||||
if message:
|
if message:
|
||||||
url = reverse(workout_edit_view,
|
url = reverse(workout_edit_view,
|
||||||
|
|||||||
Reference in New Issue
Block a user