works now - send workout to email message
This commit is contained in:
@@ -16,6 +16,7 @@ from math import sin,cos,atan2,sqrt
|
||||
import os,sys
|
||||
import gzip
|
||||
import base64
|
||||
import yaml
|
||||
|
||||
# Django
|
||||
from django.shortcuts import render_to_response
|
||||
@@ -154,6 +155,14 @@ def get_polar_workouts(user):
|
||||
if response.status_code == 201:
|
||||
|
||||
workoutsbox = Mailbox.objects.filter(name='workouts')[0]
|
||||
uploadoptions = {
|
||||
'makeprivate':False,
|
||||
}
|
||||
|
||||
bodyyaml = yaml.safe_dump(
|
||||
uploadoptions,
|
||||
default_flow_style=False
|
||||
)
|
||||
|
||||
transactionid = response.json()['transaction-id']
|
||||
url = baseurl+'/users/{userid}/exercise-transactions/{transactionid}'.format(
|
||||
@@ -180,11 +189,12 @@ def get_polar_workouts(user):
|
||||
|
||||
msg = Message(mailbox=workoutsbox,
|
||||
from_header=user.email,
|
||||
subject = 'Import from Polar Flow')
|
||||
subject = 'Import from Polar Flow',
|
||||
body=bodyyaml)
|
||||
|
||||
msg.save()
|
||||
|
||||
a = MessageAttachment(message=msg,document=filename)
|
||||
a = MessageAttachment(message=msg,document=filename[6:])
|
||||
a.save()
|
||||
|
||||
exercise_dict['filename'] = filename
|
||||
|
||||
Reference in New Issue
Block a user