adding some logging
This commit is contained in:
@@ -7,6 +7,8 @@ from __future__ import unicode_literals, absolute_import
|
|||||||
# All the functionality needed to connect to Strava
|
# All the functionality needed to connect to Strava
|
||||||
from scipy import optimize
|
from scipy import optimize
|
||||||
from scipy.signal import savgol_filter
|
from scipy.signal import savgol_filter
|
||||||
|
import time
|
||||||
|
from time import strftime
|
||||||
|
|
||||||
|
|
||||||
from django_mailbox.models import Message,Mailbox,MessageAttachment
|
from django_mailbox.models import Message,Mailbox,MessageAttachment
|
||||||
@@ -75,6 +77,19 @@ def get_token(code):
|
|||||||
return imports_get_token(code, oauth_data)
|
return imports_get_token(code, oauth_data)
|
||||||
|
|
||||||
def strava_open(user):
|
def strava_open(user):
|
||||||
|
t = time.localtime()
|
||||||
|
timestamp = time.strftime('%b-%d-%Y_%H%M', t)
|
||||||
|
with open('strava_webhooks.log','a') as f:
|
||||||
|
f.write('\n')
|
||||||
|
f.write(timestamp)
|
||||||
|
f.write(' ')
|
||||||
|
f.write('Getting token for user ')
|
||||||
|
f.write(str(user.rower.id))
|
||||||
|
f.write(' token expiry ')
|
||||||
|
f.write(str(user.rower.stravatokenexpirydate))
|
||||||
|
f.write(' ')
|
||||||
|
f.write(json.dumps(oauth_data))
|
||||||
|
f.write('\n')
|
||||||
token = imports_open(user, oauth_data)
|
token = imports_open(user, oauth_data)
|
||||||
if user.rower.strava_owner_id == 0:
|
if user.rower.strava_owner_id == 0:
|
||||||
strava_owner_id = set_strava_athlete_id(user)
|
strava_owner_id = set_strava_athlete_id(user)
|
||||||
@@ -357,7 +372,7 @@ def async_get_workout(user,stravaid):
|
|||||||
token = strava_open(user)
|
token = strava_open(user)
|
||||||
except NoTokenError:
|
except NoTokenError:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
csvfilename = 'media/{code}_{stravaid}.csv'.format(code=uuid4().hex[:16],stravaid=stravaid)
|
csvfilename = 'media/{code}_{stravaid}.csv'.format(code=uuid4().hex[:16],stravaid=stravaid)
|
||||||
job = myqueue(queue,
|
job = myqueue(queue,
|
||||||
fetch_strava_workout,
|
fetch_strava_workout,
|
||||||
|
|||||||
Reference in New Issue
Block a user