Private
Public Access
1
0

strava prepare for their update

This commit is contained in:
Sander Roosendaal
2018-09-22 13:08:03 +02:00
parent 9b7d385b1c
commit 60940a821c
2 changed files with 15 additions and 0 deletions

View File

@@ -122,6 +122,13 @@ def imports_do_refresh_token(refreshtoken,oauth_data,access_token=''):
'Accept': 'application/json',
'Content-Type': oauth_data['content_type']}
# for Strava
if 'grant_type' in oauth_data:
if oauth_data['grant_type']:
post_data['grant_type'] = oauth_data['grant_type']
else:
grant_type = post_data.pop('grant_type',None)
if oauth_data['bearer_auth']:
headers['authorization'] = 'Bearer %s' % access_token
@@ -193,6 +200,13 @@ def imports_get_token(
'Content-Type': 'application/json',
'user-agent': 'sanderroosendaal'}
if 'grant_type' in oauth_data:
if oauth_data['grant_type']:
post_data['grant_type'] = oauth_data['grant_type']
else:
grant_type = post_data.pop('grant_type',None)
if 'json' in oauth_data['content_type']:
response = requests.post(
base_uri,

View File

@@ -44,6 +44,7 @@ oauth_data = {
'expirydatename': '',
'bearer_auth': True,
'base_url': "https://www.strava.com/oauth/token",
'grant_type': None,
}