fix
This commit is contained in:
@@ -9,6 +9,7 @@ import zipfile
|
||||
from zipfile import BadZipFile
|
||||
import re
|
||||
import time
|
||||
import traceback
|
||||
from time import strftime
|
||||
|
||||
import requests
|
||||
@@ -192,26 +193,48 @@ class Command(BaseCommand):
|
||||
failedmailbox = Mailbox.objects.get(name='Failed')
|
||||
|
||||
# Polar
|
||||
polar_available = polarstuff.get_polar_notifications()
|
||||
res = polarstuff.get_all_new_workouts(polar_available)
|
||||
try:
|
||||
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
|
||||
rowers = Rower.objects.filter(c2_auto_import=True)
|
||||
for r in rowers: # pragma: no cover
|
||||
if user_is_not_basic(r.user):
|
||||
c2stuff.get_c2_workouts(r)
|
||||
try:
|
||||
rowers = Rower.objects.filter(c2_auto_import=True)
|
||||
for r in rowers: # pragma: no cover
|
||||
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)
|
||||
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)
|
||||
try:
|
||||
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)
|
||||
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)
|
||||
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):
|
||||
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'])
|
||||
try:
|
||||
rp3ids = workouts_list['id'].values
|
||||
|
||||
Reference in New Issue
Block a user