Skip to content

Commit

Permalink
Implement login page in Sample Bottle App.
Browse files Browse the repository at this point in the history
  • Loading branch information
aouyar committed Jan 10, 2013
1 parent 78003aa commit b451df8
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
26 changes: 26 additions & 0 deletions samples/bottle/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<html>
<head>
<title>Health Graph API Demo</title>
</head>
<body>
<div align="center" style="width:100%;">
<div align="center" style="width:720px;display:inline-block;">
<h1>HealthGraph-API Demo</h1>
<p align="left">
<a href="https://github.com/aouyar/healthgraph-api">HealthGraph-API</a>
is a Python Client Library for
<a href="http://developer.runkeeper.com/healthgraph">Health Graph API</a>.
The API can be used for accessing
<a href="http://runkeeper.com">RunKeeper.com</a> for
retrieving, updating, deleting and uploading
Fitness Activity and Health Measurements Information.
</p>
<p>
<a href="{{ rk_auth_uri }}">
<img src="{{ rk_button_img }}" alt="RunKeeper Login Button">
</a>
</p>
</div>
</div>
</body>
</html>
9 changes: 8 additions & 1 deletion samples/bottle/runkeeper_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import optparse
import ConfigParser
import bottle
from healthgraph import RunKeeperAuthMgr, RunKeeperClient
from beaker.middleware import SessionMiddleware


__author__ = "Ali Onur Uyar"
Expand All @@ -35,7 +37,12 @@

@bottle.route('/')
def index():
return bottle.template('index.html')
rk_auth_mgr = RunKeeperAuthMgr(conf['client_id'], conf['client_secret'],
'/'.join((conf['baseurl'], 'login',)))
rk_auth_uri = rk_auth_mgr.getLoginURL()
rk_button_img = rk_auth_mgr.getLoginButtonURL('blue', 'black', 300)
return bottle.template('index.html', {'rk_button_img': rk_button_img,
'rk_auth_uri': rk_auth_uri,})



Expand Down

0 comments on commit b451df8

Please sign in to comment.