In my current project I had a task to use twitter API. Twitter uses OAuth for authentication, which is pretty dreary. To avoid fiddling with it all the time, I've moved authentication to decorator, now it looks like this:
Decorator checks if key is available, and, if needed - initiates authentication. User is redirected to twitter, grants permission and is redirected back to site, to the same place where he left off. If key is available - nothing happens, just view is launched as usual.
It's convenient that there's no need for additional twitter settings in user profile.
tweepy is used as an API wrapper.
absolute_url
should return full url, with http://request.path
you can also store POST
and GET
.callback_url