some changes
This commit is contained in:
@@ -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'] = ''
|
||||
|
||||
|
||||
Reference in New Issue
Block a user