strava working with correct scope
This commit is contained in:
@@ -32,6 +32,7 @@ oauth_data = {
|
||||
'expirydatename': 'tokenexpirydate',
|
||||
'bearer_auth': True,
|
||||
'base_url': "https://log.concept2.com/oauth/access_token",
|
||||
'scope':'write',
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -216,6 +216,8 @@ def imports_get_token(
|
||||
if 'grant_type' in oauth_data:
|
||||
if oauth_data['grant_type']:
|
||||
post_data['grant_type'] = oauth_data['grant_type']
|
||||
if 'strava' in oauth_data['autorization_uri']:
|
||||
post_data['grant_type'] = "authorization_code"
|
||||
else:
|
||||
grant_type = post_data.pop('grant_type',None)
|
||||
|
||||
@@ -265,7 +267,7 @@ def imports_make_authorization_url(oauth_data):
|
||||
params = {"client_id": oauth_data['client_id'],
|
||||
"response_type": "code",
|
||||
"redirect_uri": oauth_data['redirect_uri'],
|
||||
"scope":"write",
|
||||
"scope":oauth_data['scope'],
|
||||
"state":state}
|
||||
|
||||
|
||||
|
||||
@@ -19,7 +19,8 @@ oauth_data = {
|
||||
'expirydatename': None,
|
||||
'bearer_auth': True,
|
||||
'base_url': "https://runkeeper.com/apps/token",
|
||||
'headers': {'user-agent': 'sanderroosendaal'}
|
||||
'headers': {'user-agent': 'sanderroosendaal'},
|
||||
'scope':'write',
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ oauth_data = {
|
||||
'expirydatename': 'sporttrackstokenexpirydate',
|
||||
'bearer_auth': False,
|
||||
'base_url': "https://api.sporttracks.mobi/oauth2/token",
|
||||
'scope':'write',
|
||||
}
|
||||
|
||||
# Checks if user has SportTracks token, renews them if they are expired
|
||||
|
||||
@@ -33,6 +33,12 @@ except ImportError:
|
||||
|
||||
from rowers.imports import *
|
||||
|
||||
headers = {'Accept': 'application/json',
|
||||
'Api-Key': STRAVA_CLIENT_ID,
|
||||
'Content-Type': 'application/json',
|
||||
'user-agent': 'sanderroosendaal'}
|
||||
|
||||
|
||||
oauth_data = {
|
||||
'client_id': STRAVA_CLIENT_ID,
|
||||
'client_secret': STRAVA_CLIENT_SECRET,
|
||||
@@ -45,6 +51,8 @@ oauth_data = {
|
||||
'bearer_auth': True,
|
||||
'base_url': "https://www.strava.com/oauth/token",
|
||||
'grant_type': 'refresh_token',
|
||||
'headers': headers,
|
||||
'scope':'activity:write,activity:read_all',
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
Please correct the error{{ form.errors|pluralize }} below.
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
<p>
|
||||
<form enctype="multipart/form-data" action="" method="post">
|
||||
<table>
|
||||
{{ form.as_table }}
|
||||
@@ -17,6 +17,16 @@
|
||||
{% csrf_token %}
|
||||
<input class="button green" type="submit" value="Save">
|
||||
</form>
|
||||
</p>
|
||||
<p>Click on one of the icons below to connect to the service of your
|
||||
choice or to renew the authorization</p>
|
||||
<p><a href="/rowers/me/stravaauthorize/"><img src="/static/img/ConnectWithStrava.png" alt="connect with strava" width="120"></a></p>
|
||||
<p><a href="/rowers/me/c2authorize/"><img src="/static/img/blueC2logo.png" alt="connect with Concept2" width="120"></a></p>
|
||||
<p><a href="/rowers/me/sporttracksauthorize/"><img src="/static/img/sporttracks-button.png" alt="connect with SportTracks" width="120"></a></p>
|
||||
<p><a href="/rowers/me/runkeeperauthorize/"><img src="/static/img/rk-logo.png" alt="connect with RunKeeper" width="120"></a></p>
|
||||
<p><a href="/rowers/me/underarmourauthorize/"><img src="/static/img/UAbtn.png" alt="connect with Under Armour" width="120"></a></p>
|
||||
<p><a href="/rowers/me/polarauthorize/"><img src="/static/img/Polar_connectwith_btn_white.png"
|
||||
alt="connect with Polar" width="130"></a></p>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ oauth_data = {
|
||||
'expirydatename': 'tptokenexpirydate',
|
||||
'bearer_auth': False,
|
||||
'base_url': "https://oauth.trainingpeaks.com/oauth/token",
|
||||
'scope':'write',
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ oauth_data = {
|
||||
'expirydatename': 'underarmourtokenexpirydate',
|
||||
'bearer_auth': True,
|
||||
'base_url': "https://api.ua.com/v7.1/oauth2/access_token/",
|
||||
'scope':'write',
|
||||
}
|
||||
|
||||
# Checks if user has UnderArmour token, renews them if they are expired
|
||||
|
||||
@@ -2070,7 +2070,7 @@ def rower_strava_authorize(request):
|
||||
params = {"client_id": STRAVA_CLIENT_ID,
|
||||
"response_type": "code",
|
||||
"redirect_uri": STRAVA_REDIRECT_URI,
|
||||
"scope": "write"}
|
||||
"scope": "activity:write,activity:read_all"}
|
||||
|
||||
url = "https://www.strava.com/oauth/authorize?"+ urllib.urlencode(params)
|
||||
|
||||
@@ -2408,6 +2408,7 @@ def rower_process_polarcallback(request):
|
||||
def rower_process_stravacallback(request):
|
||||
try:
|
||||
code = request.GET['code']
|
||||
scope = request.GET['scope']
|
||||
except MultiValueDictKeyError:
|
||||
try:
|
||||
message = request.GET['error']
|
||||
@@ -6089,10 +6090,7 @@ def multiflex_data(request,userid=0,
|
||||
yerror = groups.std()[yparam]
|
||||
groupsize = groups.count()[xparam]
|
||||
|
||||
print groupsize.sum(),groupsize.mean()
|
||||
|
||||
mask = groupsize <= min([0.01*groupsize.sum(),0.2*groupsize.mean()])
|
||||
print '--------------------------'
|
||||
xvalues.loc[mask] = np.nan
|
||||
|
||||
yvalues.loc[mask] = np.nan
|
||||
|
||||
Reference in New Issue
Block a user