adding strava webhook management commands
This commit is contained in:
@@ -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