garmin files - not working
This commit is contained in:
@@ -1031,6 +1031,37 @@ def garmin_summaries_view(request):
|
||||
|
||||
return HttpResponse(status=200)
|
||||
|
||||
@csrf_exempt
|
||||
def garmin_newfiles_ping(request):
|
||||
t = time.localtime()
|
||||
timestamp = time.strftime('%b-%d-%Y_%H%M', t)
|
||||
with open('garminlog.log','a') as f:
|
||||
f.write('\n')
|
||||
f.write(timestamp)
|
||||
f.write(' ')
|
||||
f.write(str(request.body))
|
||||
|
||||
if request.method != 'POST':
|
||||
return HttpResponse(status=200)
|
||||
|
||||
data = json.loads(request.body)
|
||||
files = data['activityFiles']
|
||||
for file in data['activityFiles']:
|
||||
try:
|
||||
garmintoken = file['userAccessToken']
|
||||
try:
|
||||
r = Rower.objects.get(garmintoken=garmintoken
|
||||
)
|
||||
callbackURL = file['callbackURL']
|
||||
starttime = file['startTimeInSeconds']
|
||||
job = get_garmin_file(r,callbackURL,starttime)
|
||||
except Rower.DoesNotExist:
|
||||
pass
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
return HttpResponse(status=200)
|
||||
|
||||
@csrf_exempt
|
||||
def garmin_deregistration_view(request):
|
||||
if request.method != 'POST':
|
||||
|
||||
Reference in New Issue
Block a user