adding webhook processing for strava - does not do anything useful yet
This commit is contained in:
@@ -43,6 +43,8 @@ except ImportError:
|
||||
|
||||
from rowers.imports import *
|
||||
|
||||
webhookverification = "kudos_to_rowing"
|
||||
|
||||
headers = {'Accept': 'application/json',
|
||||
'Api-Key': STRAVA_CLIENT_ID,
|
||||
'Content-Type': 'application/json',
|
||||
@@ -97,6 +99,25 @@ def rower_strava_token_refresh(user):
|
||||
def make_authorization_url(request):
|
||||
return imports_make_authorization_url(oauth_data)
|
||||
|
||||
def strava_establish_push():
|
||||
url = "https://www.strava.com/api/v3/push_subscriptions"
|
||||
post_data = {
|
||||
'client_id': STRAVA_CLIENT_ID,
|
||||
'client_secret': STRAVA_CLIENT_SECRET,
|
||||
'callback_url': 'http://localhost:8000/rowers/strava/webhooks/',
|
||||
'verify_token': webhookverification,
|
||||
}
|
||||
headers = {'user-agent': 'sanderroosendaal',
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': oauth_data['content_type']}
|
||||
|
||||
response = requests.post(url,data=post_data)
|
||||
|
||||
print(response.json())
|
||||
|
||||
return response.status_code
|
||||
|
||||
|
||||
def set_strava_athlete_id(user):
|
||||
r = Rower.objects.get(user=user)
|
||||
if (r.stravatoken == '') or (r.stravatoken is None):
|
||||
|
||||
Reference in New Issue
Block a user