Private
Public Access
1
0

some changes

This commit is contained in:
Sander Roosendaal
2021-12-16 16:13:58 +01:00
parent bcfeb28854
commit bdb0e55ca4
13 changed files with 31 additions and 846 deletions

View File

@@ -47,8 +47,6 @@ from io import StringIO
import stravalib
from stravalib.exc import ActivityUploadFailed,TimeoutExceeded
from django_mailbox.models import Message,Mailbox,MessageAttachment
from rowsandall_app.settings import (
POLAR_CLIENT_ID, POLAR_REDIRECT_URI, POLAR_CLIENT_SECRET,
)
@@ -231,17 +229,21 @@ def get_polar_workouts(user):
with open(filename,'wb') as fop:
fop.write(response.content)
msg = Message(mailbox=workoutsbox,
from_header=user.email,
subject = '',
body=bodyyaml)
# post file to upload api
json_data = {
'title':'',
'workouttype':'',
'user':user.id,
'secret':settings.UPLOAD_SERVICE_SECRET,
'file':filename,
}
url = reverse('workout_upload_api')
response = requests.post(url,json_data)
msg.save()
a = MessageAttachment(message=msg,document=filename[6:])
a.save()
exercise_dict['filename'] = filename
if response.status_code == 200:
exercise_dict['filename'] = filename
else:
print(response.status_code)
else:
exercise_dict['filename'] = ''