Very nice! just one detail to make it easier for the ones that do not have apt-get...
sudo apt-get install python-oauth2 can be replaced with: pip install --user python-oauth2 making it portable to any environment where web2py works 2015-01-03 13:44 GMT+01:00 Falko Delarue <falko.kra...@gmail.com>: > This is how you login to your web2py app with Tubmblr > > Register a Tubmblr app (you will of course need a Tubmblr account) > > https://www.tumblr.com/oauth/register > > and configure later at > > https://www.tumblr.com/settings/apps > > get the consumer key and secret > > install the oauth2 lib (instructions only for ubuntu) > > sudo apt-get install python-oauth2 > > download the pytumblr lib from (Download ZIP in right menu) > > https://github.com/tumblr/pytumblr > > extract only the pytumblr folder to yourapp/modules > > edit yourapp/modules/pytumblr/__init__.py and add dot "." in front of the > helpers and request import like this > > from .helpers import validate_params, validate_blogname > from .request import TumblrRequest > > add the following code to your db.py > > consumer_key = 'XXXXXXX' > consumer_secret = 'XXXXXX' > > request_token_url = 'http://www.tumblr.com/oauth/request_token' > authorize_url = 'http://www.tumblr.com/oauth/authorize' > access_token_url = 'http://www.tumblr.com/oauth/access_token' > > from gluon.contrib.login_methods.oauth10a_account import OAuthAccount > import pytumblr > > class TumblrOAuth(OAuthAccount): > """OAuth for Tumblr""" > def get_user(self): > if not self.accessToken(): > return None > > client = pytumblr.TumblrRestClient( > consumer_key, > consumer_secret, > self.accessToken().key, > self.accessToken().secret, > ) > > info = client.info() > if info and ('user' in info): > return dict( > first_name=info['user']['name'], > registration_id='tumblr:%s' % info['user']['name'], > ) > > auth.settings.login_form = TumblrOAuth(globals(), consumer_key, > consumer_secret, authorize_url, request_token_url, access_token_url) > > Replace the consumer key and secret with yours! Tumblr does not provide > first or last name or an id thats why only the crude info in the return. I > do not really need to create proper users so this is enough for me, you can > improve on that. Also this approach will let you log in only with Tumblr, > you will have to figure our the rest, this is only a basic tutorial. > > Did I miss anything? Did you like that? Write a comment! > > -- > Resources: > - http://web2py.com > - http://web2py.com/book (Documentation) > - http://github.com/web2py/web2py (Source code) > - https://code.google.com/p/web2py/issues/list (Report Issues) > --- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.