Private
Public Access
1
0

not working yet

This commit is contained in:
2024-12-19 14:36:45 +01:00
parent 9d500265e1
commit af00ed2280
2 changed files with 21 additions and 2 deletions

View File

@@ -20,7 +20,7 @@ from rowsandall_app.settings import (
from rowers.tasks import (
handle_c2_import_stroke_data, handle_c2_sync, handle_c2_async_workout,
handle_c2_getworkout
handle_c2_getworkout, handle_c2_getworkout_csv
)
import django_rq
queue = django_rq.get_queue('default')
@@ -365,7 +365,7 @@ class C2Integration(SyncIntegration):
record = create_or_update_syncrecord(r, None, c2id=id)
_ = myqueue(queuehigh,
handle_c2_getworkout,
handle_c2_getworkout_csv,
self.user.id,
self.rower.c2token,
id,

View File

@@ -3555,6 +3555,25 @@ def handle_intervals_getworkout(rower, intervalstoken, workoutid, debug=False, *
return 1
@app.task
def handle_c2_getworkout_csv(userid, c2token, c2id, defaulttimezone, debug=False, **kwargs):
authorizationstring = str('Bearer ' + c2token)
headers = {'Authorization': authorizationstring,
'user-agent': 'sanderroosendaal',
'Content-Type': 'application/json'}
url = "https://log.concept2.com/api/users/me/results/"+str(c2id)+"/export/fit"
print(url)
print(c2token)
response = requests.get(url, headers=headers)
if response.status_code != 200:
print(response.status_code, response.text)
return 0
# get the file from the content data
print(response.status_code,"aap")
@app.task
def handle_c2_getworkout(userid, c2token, c2id, defaulttimezone, debug=False, **kwargs):
authorizationstring = str('Bearer ' + c2token)