Private
Public Access
1
0

Merge branch 'feature/webhooks5' into develop

This commit is contained in:
Sander Roosendaal
2020-07-14 20:45:56 +02:00
2 changed files with 33 additions and 6 deletions

View File

@@ -1599,14 +1599,18 @@ def get_workouttype_from_fit(filename,workouttype='water'):
import rowingdata.tcxtools as tcxtools
def get_workouttype_from_tcx(filename,workouttype='water'):
d = tcxtools.tcx_getdict(filename)
tcxtype = 'rowing'
try:
tcxtype = d['Activities']['Activity']['@Sport'].lower()
if tcxtype == 'other':
tcxtype = 'rowing'
except KeyError:
return workouttype
d = tcxtools.tcx_getdict(filename)
try:
tcxtype = d['Activities']['Activity']['@Sport'].lower()
if tcxtype == 'other':
tcxtype = 'rowing'
except KeyError:
return workouttype
except TypeError:
pass
try:
workouttype = mytypes.garminmappinginv[tcxtype.upper()]

View File

@@ -119,6 +119,29 @@ def strava_establish_push():
return response.status_code
def strava_list_push():
url = "https://www.strava.com/api/v3/push_subscriptions"
params = {
'client_id': STRAVA_CLIENT_ID,
'client_secret': STRAVA_CLIENT_SECRET,
}
response = requests.get(url,params=params)
if response.status_code == 200:
data = response.json()
return [w['id'] for w in data]
return []
def strava_push_delete(id):
url = "https://www.strava.com/api/v3/push_subscriptions/{id}".format(id=id)
params = {
'client_id': STRAVA_CLIENT_ID,
'client_secret': STRAVA_CLIENT_SECRET,
}
response = requests.delete(url,json=params)
return response.status_code
def set_strava_athlete_id(user):
r = Rower.objects.get(user=user)