Created
October 2, 2010 03:18
-
-
Save lepture/607236 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pydouban | |
@route('/login') | |
class Login(WebHandler): | |
def get(self): | |
auth = pydouban.Auth(key, secret) # your consumer key and secret | |
dic = auth.login('http://localhost/auth') | |
memcache.set('douban', dic) | |
return self.redirect(dic['url']) | |
@route('/auth') | |
class Auth(WebHandler): | |
def get(self): | |
auth = pydouban.Auth(key, secret) | |
dic = memcache.get('douban') | |
qs = auth.get_acs_token(dic['oauth_token'],dic['oauth_token_secret']) | |
db.Douban.set('qs', qs) | |
return self.response('Get access token ' + qs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment