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
|
import rowingdata.tcxtools as tcxtools
|
||||||
|
|
||||||
def get_workouttype_from_tcx(filename,workouttype='water'):
|
def get_workouttype_from_tcx(filename,workouttype='water'):
|
||||||
d = tcxtools.tcx_getdict(filename)
|
|
||||||
tcxtype = 'rowing'
|
tcxtype = 'rowing'
|
||||||
try:
|
try:
|
||||||
tcxtype = d['Activities']['Activity']['@Sport'].lower()
|
d = tcxtools.tcx_getdict(filename)
|
||||||
if tcxtype == 'other':
|
try:
|
||||||
tcxtype = 'rowing'
|
tcxtype = d['Activities']['Activity']['@Sport'].lower()
|
||||||
except KeyError:
|
if tcxtype == 'other':
|
||||||
return workouttype
|
tcxtype = 'rowing'
|
||||||
|
except KeyError:
|
||||||
|
return workouttype
|
||||||
|
|
||||||
|
except TypeError:
|
||||||
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
workouttype = mytypes.garminmappinginv[tcxtype.upper()]
|
workouttype = mytypes.garminmappinginv[tcxtype.upper()]
|
||||||
|
|||||||
@@ -119,6 +119,29 @@ def strava_establish_push():
|
|||||||
|
|
||||||
return response.status_code
|
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):
|
def set_strava_athlete_id(user):
|
||||||
r = Rower.objects.get(user=user)
|
r = Rower.objects.get(user=user)
|
||||||
|
|||||||
Reference in New Issue
Block a user