fix
This commit is contained in:
@@ -9,6 +9,7 @@ import zipfile
|
|||||||
from zipfile import BadZipFile
|
from zipfile import BadZipFile
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
|
import traceback
|
||||||
from time import strftime
|
from time import strftime
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
@@ -192,26 +193,48 @@ class Command(BaseCommand):
|
|||||||
failedmailbox = Mailbox.objects.get(name='Failed')
|
failedmailbox = Mailbox.objects.get(name='Failed')
|
||||||
|
|
||||||
# Polar
|
# Polar
|
||||||
polar_available = polarstuff.get_polar_notifications()
|
try:
|
||||||
res = polarstuff.get_all_new_workouts(polar_available)
|
polar_available = polarstuff.get_polar_notifications()
|
||||||
|
res = polarstuff.get_all_new_workouts(polar_available)
|
||||||
|
except:
|
||||||
|
exc_type, exc_value, exc_traceback = sys.exc_info()
|
||||||
|
lines = traceback.format_exception(exc_type, exc_value, exc_traceback)
|
||||||
|
dologging('processemail.log',''.join('!! ' + line for line in lines))
|
||||||
|
|
||||||
# Concept2
|
# Concept2
|
||||||
rowers = Rower.objects.filter(c2_auto_import=True)
|
try:
|
||||||
for r in rowers: # pragma: no cover
|
rowers = Rower.objects.filter(c2_auto_import=True)
|
||||||
if user_is_not_basic(r.user):
|
for r in rowers: # pragma: no cover
|
||||||
c2stuff.get_c2_workouts(r)
|
if user_is_not_basic(r.user):
|
||||||
|
c2stuff.get_c2_workouts(r)
|
||||||
|
except:
|
||||||
|
exc_type, exc_value, exc_traceback = sys.exc_info()
|
||||||
|
lines = traceback.format_exception(exc_type, exc_value, exc_traceback)
|
||||||
|
dologging('processemail.log',''.join('!! ' + line for line in lines))
|
||||||
|
|
||||||
rowers = Rower.objects.filter(rp3_auto_import=True)
|
|
||||||
for r in rowers: # pragma: no cover
|
|
||||||
if user_is_not_basic(r.user):
|
|
||||||
res = rp3stuff.get_rp3_workouts(r)
|
|
||||||
|
|
||||||
rowers = Rower.objects.filter(nk_auto_import=True)
|
try:
|
||||||
for r in rowers: # pragma: no cover
|
rowers = Rower.objects.filter(rp3_auto_import=True)
|
||||||
if user_is_not_basic(r.user):
|
for r in rowers: # pragma: no cover
|
||||||
s = 'Starting NK Auto Import for user {id}'.format(id=r.user.id)
|
if user_is_not_basic(r.user):
|
||||||
dologging('nklog.log',s)
|
res = rp3stuff.get_rp3_workouts(r)
|
||||||
res = nkstuff.get_nk_workouts(r)
|
except:
|
||||||
|
exc_type, exc_value, exc_traceback = sys.exc_info()
|
||||||
|
lines = traceback.format_exception(exc_type, exc_value, exc_traceback)
|
||||||
|
dologging('processemail.log',''.join('!! ' + line for line in lines))
|
||||||
|
|
||||||
|
try:
|
||||||
|
rowers = Rower.objects.filter(nk_auto_import=True)
|
||||||
|
for r in rowers: # pragma: no cover
|
||||||
|
if user_is_not_basic(r.user):
|
||||||
|
s = 'Starting NK Auto Import for user {id}'.format(id=r.user.id)
|
||||||
|
dologging('nklog.log',s)
|
||||||
|
res = nkstuff.get_nk_workouts(r)
|
||||||
|
except:
|
||||||
|
exc_type, exc_value, exc_traceback = sys.exc_info()
|
||||||
|
lines = traceback.format_exception(exc_type, exc_value, exc_traceback)
|
||||||
|
dologging('processemail.log',''.join('!! ' + line for line in lines))
|
||||||
|
|
||||||
|
|
||||||
messages = Message.objects.filter(mailbox_id = workoutmailbox.id)
|
messages = Message.objects.filter(mailbox_id = workoutmailbox.id)
|
||||||
message_ids = [m.id for m in messages]
|
message_ids = [m.id for m in messages]
|
||||||
|
|||||||
@@ -137,7 +137,8 @@ def get_rp3_workouts(rower,do_async=True): # pragma: no cover
|
|||||||
if (res.status_code != 200):
|
if (res.status_code != 200):
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
dologging('rp3_import.log',res.json())
|
s = '{d}'.format(d=res.json())
|
||||||
|
dologging('rp3_import.log',s)
|
||||||
workouts_list = pd.json_normalize(res.json()['data']['workouts'])
|
workouts_list = pd.json_normalize(res.json()['data']['workouts'])
|
||||||
try:
|
try:
|
||||||
rp3ids = workouts_list['id'].values
|
rp3ids = workouts_list['id'].values
|
||||||
|
|||||||
Reference in New Issue
Block a user