Private
Public Access
1
0

more logging on strava

This commit is contained in:
Sander Roosendaal
2020-09-24 22:16:04 +02:00
parent 5a774ba5be
commit 1d12985cd3
2 changed files with 21 additions and 0 deletions

View File

@@ -2760,7 +2760,11 @@ def fetch_strava_workout(stravatoken,oauth_data,stravaid,csvfilename,userid,debu
f.write('Response json {json}\n'.format(json=response.json()))
return 0
workoutsummary = requests.get(url,headers=headers).json()
try:
startdatetime = workoutsummary['start_date']
except KeyError:
@@ -2774,6 +2778,16 @@ def fetch_strava_workout(stravatoken,oauth_data,stravaid,csvfilename,userid,debu
coords = get_strava_stream(None,'latlng',stravaid,authorizationstring=authorizationstring)
power = get_strava_stream(None,'watts',stravaid,authorizationstring=authorizationstring)
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(url)
f.write(' ')
f.write('Response data {data}\n'.format(data=workoutsummary))
if t is not None:
nr_rows = len(t)
else:

View File

@@ -1064,6 +1064,13 @@ def strava_webhook_view(request):
ws = Workout.objects.filter(uploadedtostrava=stravaid)
if ws.count()==0 and r.strava_auto_import:
job = stravastuff.async_get_workout(r.user,stravaid)
if job == 0:
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('Strava strava_open yielded NoTokenError')
else:
timestamp = time.strftime('%b-%d-%Y_%H%M', t)
with open('strava_webhooks.log','a') as f: