adding rp3 auto import
This commit is contained in:
@@ -2872,7 +2872,7 @@ def add2(x, y,debug=False,**kwargs):
|
||||
graphql_url = "https://rp3rowing-app.com/graphql"
|
||||
|
||||
@app.task
|
||||
def handle_rp3_async_workout(userid,rp3token,rp3id,startdatetime,debug=False,**kwargs):
|
||||
def handle_rp3_async_workout(userid,rp3token,rp3id,startdatetime,max_attempts,debug=False,**kwargs):
|
||||
headers = {'Authorization': 'Bearer ' + rp3token }
|
||||
|
||||
get_download_link = """{
|
||||
@@ -2886,7 +2886,7 @@ def handle_rp3_async_workout(userid,rp3token,rp3id,startdatetime,debug=False,**k
|
||||
have_link = False
|
||||
download_url = ''
|
||||
counter = 0
|
||||
max_attempts = 20
|
||||
#max_attempts = 20
|
||||
waittime = 3
|
||||
while not have_link:
|
||||
response = requests.post(
|
||||
@@ -2895,6 +2895,7 @@ def handle_rp3_async_workout(userid,rp3token,rp3id,startdatetime,debug=False,**k
|
||||
json={'query': get_download_link}
|
||||
)
|
||||
|
||||
|
||||
if response.status_code != 200:
|
||||
have_link = True
|
||||
|
||||
@@ -2915,6 +2916,7 @@ def handle_rp3_async_workout(userid,rp3token,rp3id,startdatetime,debug=False,**k
|
||||
return 0
|
||||
|
||||
filename = 'media/RP3Import_'+str(rp3id)+'.csv'
|
||||
|
||||
res = requests.get(download_url,headers=headers)
|
||||
|
||||
if not startdatetime:
|
||||
@@ -2933,7 +2935,7 @@ def handle_rp3_async_workout(userid,rp3token,rp3id,startdatetime,debug=False,**k
|
||||
'file': filename,
|
||||
'workouttype':'dynamic',
|
||||
'boattype':'1x',
|
||||
'rp3id':rp3id,
|
||||
'rp3id':int(rp3id),
|
||||
'startdatetime':startdatetime,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user