Merge branch 'release/v18.5.2'
This commit is contained in:
@@ -111,8 +111,6 @@ class Command(BaseCommand):
|
||||
rowers = Rower.objects.filter(nk_auto_import=True)
|
||||
for r in rowers: # pragma: no cover
|
||||
if user_is_not_basic(r.user):
|
||||
s = 'Starting NK Auto Import for user {id}'.format(id=r.user.id)
|
||||
dologging('nklog.log', s)
|
||||
_ = nkstuff.get_nk_workouts(r)
|
||||
except: # pragma: no cover
|
||||
exc_type, exc_value, exc_traceback = sys.exc_info()
|
||||
|
||||
@@ -123,8 +123,11 @@ def get_nk_workouts(rower, do_async=True, before=0, after=0):
|
||||
|
||||
knownnkids = uniqify(knownnkids+tombstones+parkedids)
|
||||
newids = [nkid for nkid in nkids if nkid not in knownnkids]
|
||||
s = 'New NK IDs {newids}'.format(newids=newids)
|
||||
dologging('nklog.log', s)
|
||||
if newids:
|
||||
s = 'Starting NK Auto Import for user {id}'.format(id=r.user.id)
|
||||
dologging('nklog.log', s)
|
||||
s = 'New NK IDs {newids} (user {id})'.format(newids=newids,id=rower.user.id)
|
||||
dologging('nklog.log', s)
|
||||
|
||||
newparkedids = uniqify(newids+parkedids)
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import time
|
||||
from django_rq import job
|
||||
# All the functionality needed to connect to Runkeeper
|
||||
from rowers.imports import *
|
||||
from rowers.utils import dologging
|
||||
|
||||
# Python
|
||||
import gzip
|
||||
@@ -16,10 +17,10 @@ from rowsandall_app.settings import (
|
||||
C2_CLIENT_ID, C2_REDIRECT_URI, C2_CLIENT_SECRET,
|
||||
STRAVA_CLIENT_ID, STRAVA_REDIRECT_URI, STRAVA_CLIENT_SECRET,
|
||||
TP_CLIENT_ID, TP_CLIENT_SECRET,
|
||||
TP_REDIRECT_URI, TP_CLIENT_KEY,
|
||||
TP_REDIRECT_URI, TP_CLIENT_KEY,TP_API_LOCATION
|
||||
)
|
||||
|
||||
tpapilocation = "https://api.trainingpeaks.com"
|
||||
tpapilocation = TP_API_LOCATION
|
||||
|
||||
oauth_data = {
|
||||
'client_id': TP_CLIENT_ID,
|
||||
@@ -151,6 +152,9 @@ def uploadactivity(access_token, filename, description='',
|
||||
headers=headers, verify=False)
|
||||
|
||||
if resp.status_code != 200: # pragma: no cover
|
||||
dologging('tp_export.log',resp.status_code)
|
||||
dologging('tp_export.log',resp.reason)
|
||||
dologging('tp_export.log',json.dumps(data))
|
||||
return 0, resp.reason, resp.status_code, headers
|
||||
else:
|
||||
return resp.json()[0]["Id"], "ok", 200, ""
|
||||
@@ -193,6 +197,7 @@ def workout_tp_upload(user, w): # pragma: no cover
|
||||
return 'Successfully synchronized to TrainingPeaks', tpid
|
||||
|
||||
else: # no tcxfile
|
||||
dologging('tp_export.log','Failed to create tcx file')
|
||||
message = "Upload to TrainingPeaks failed"
|
||||
w.uploadedtotp = -1
|
||||
tpid = -1
|
||||
|
||||
@@ -325,6 +325,10 @@ TP_CLIENT_ID = CFG["tp_client_id"]
|
||||
TP_CLIENT_SECRET = CFG["tp_client_secret"]
|
||||
TP_REDIRECT_URI = CFG["tp_redirect_uri"]
|
||||
TP_CLIENT_KEY = TP_CLIENT_ID
|
||||
try:
|
||||
TP_API_LOCATION = CFG['tp_api_location']
|
||||
except KeyError:
|
||||
TP_API_LOCATION = "https://api.trainingpeaks.com"
|
||||
|
||||
# RP3
|
||||
RP3_CLIENT_ID = CFG["rp3_client_id"]
|
||||
|
||||
Reference in New Issue
Block a user