Private
Public Access
1
0

API seems to work ok

This commit is contained in:
Sander Roosendaal
2016-12-22 12:21:04 +01:00
parent 2701d330ce
commit 24de5c681d
3 changed files with 18 additions and 7 deletions

View File

@@ -85,9 +85,9 @@ def get_token(code):
client_auth = requests.auth.HTTPBasicAuth(TEST_CLIENT_ID, TEST_CLIENT_SECRET) client_auth = requests.auth.HTTPBasicAuth(TEST_CLIENT_ID, TEST_CLIENT_SECRET)
post_data = {"grant_type": "authorization_code", post_data = {"grant_type": "authorization_code",
"code": code, "code": code,
"redirect_uri": TEST_REDIRECT_URI, "redirect_uri": "http://localhost:8000/rowers/test_callback",
"client_secret": TEST_CLIENT_SECRET, "client_secret": "aapnootmies",
"client_id":TEST_CLIENT_ID, "client_id":1,
} }
headers = {'Accept': 'application/json', headers = {'Accept': 'application/json',
'Content-Type': 'application/json'} 'Content-Type': 'application/json'}
@@ -99,12 +99,12 @@ def get_token(code):
data=json.dumps(post_data), data=json.dumps(post_data),
headers=headers) headers=headers)
print response.text
token_json = response.json() token_json = response.json()
thetoken = token_json['access_token'] thetoken = token_json['access_token']
expires_in = token_json['expires_in'] expires_in = token_json['expires_in']
refresh_token = token_json['refresh_token'] refresh_token = token_json['refresh_token']
return [thetoken,expires_in,refresh_token] return [thetoken,expires_in,refresh_token]
def make_authorization_url(request): def make_authorization_url(request):

View File

@@ -4830,7 +4830,7 @@ def strokedatajson(request,id):
if request.method == 'GET': if request.method == 'GET':
columns = ['spm','timesecs','hr','pseconds','power','distance'] columns = ['spm','time','hr','pace','power','distance']
datadf = dataprep.getsmallrowdata_db(columns,ids=[id]) datadf = dataprep.getsmallrowdata_db(columns,ids=[id])
return JSONResponse(datadf) return JSONResponse(datadf)

View File

@@ -200,6 +200,7 @@ MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
# user authentication # user authentication
LOGIN_REDIRECT_URL = '/rowers/list-workouts/' LOGIN_REDIRECT_URL = '/rowers/list-workouts/'
LOGIN_URL = '/login/' LOGIN_URL = '/login/'
LOGOUT_URL = '/logout/'
# Concept 2 # Concept 2
C2_CLIENT_ID = "bgTBbmjSyn8wbJb0JEdlYjDUfSZFAPQSzJV8YDwH" C2_CLIENT_ID = "bgTBbmjSyn8wbJb0JEdlYjDUfSZFAPQSzJV8YDwH"
@@ -260,7 +261,8 @@ GMAPIKEY = "AIzaSyAgu1w9QSthaGPMLp8y9JedPoMc9sfEgJ8"
OAUTH2_PROVIDER = { OAUTH2_PROVIDER = {
# this is the list of available scopes # this is the list of available scopes
'SCOPES': {'read': 'Read scope', 'write': 'Write scope', 'groups': 'Access to your groups'} 'SCOPES': {'read': 'Read scope', 'write': 'Write scope', 'groups': 'Access to your groups'},
'OAUTH2_BACKEND_CLASS': 'oauth2_provider.oauth2_backends.JSONOAuthLibCore'
} }
@@ -280,6 +282,15 @@ REST_FRAMEWORK = {
'PAGE_SIZE': 20, 'PAGE_SIZE': 20,
} }
SWAGGER_SETTINGS = {
'SECURITY_DEFINITION': {
'basic': {
'type':'basic'
}
},
'SHOW_REQUEST_HEADERS': True,
}
# Analytics # Analytics
CLICKY_SITE_ID = '101011008' CLICKY_SITE_ID = '101011008'