Merge branch 'feature/webhooks5' into develop
This commit is contained in:
@@ -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()]
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user