Public Member Functions | Private Member Functions | Static Private Attributes
tornado.auth.FriendFeedMixin Class Reference
Inheritance diagram for tornado.auth.FriendFeedMixin:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def friendfeed_request

Private Member Functions

def _oauth_consumer_token
def _oauth_get_user_future
def _on_friendfeed_request
def _parse_user_response

Static Private Attributes

string _OAUTH_ACCESS_TOKEN_URL = "https://friendfeed.com/account/oauth/access_token"
string _OAUTH_AUTHORIZE_URL = "https://friendfeed.com/account/oauth/authorize"
 _OAUTH_NO_CALLBACKS = True
string _OAUTH_REQUEST_TOKEN_URL = "https://friendfeed.com/account/oauth/request_token"
string _OAUTH_VERSION = "1.0"

Detailed Description

FriendFeed OAuth authentication.

To authenticate with FriendFeed, register your application with
FriendFeed at http://friendfeed.com/api/applications. Then copy
your Consumer Key and Consumer Secret to the application
`~tornado.web.Application.settings` ``friendfeed_consumer_key``
and ``friendfeed_consumer_secret``. Use this mixin on the handler
for the URL you registered as your application's Callback URL.

When your application is set up, you can use this mixin like this
to authenticate the user with FriendFeed and get access to their feed::

    class FriendFeedLoginHandler(tornado.web.RequestHandler,
                                 tornado.auth.FriendFeedMixin):
        @tornado.gen.coroutine
        def get(self):
            if self.get_argument("oauth_token", None):
                user = yield self.get_authenticated_user()
                # Save the user using e.g. set_secure_cookie()
            else:
                yield self.authorize_redirect()

The user object returned by `~OAuthMixin.get_authenticated_user()` includes the
attributes ``username``, ``name``, and ``description`` in addition to
``access_token``. You should save the access token with the user;
it is required to make requests on behalf of the user later with
`friendfeed_request()`.

Definition at line 760 of file auth.py.


Member Function Documentation

Subclasses must override this to return their OAuth consumer keys.

The return value should be a `dict` with keys ``key`` and ``secret``.

Reimplemented from tornado.auth.OAuthMixin.

Definition at line 861 of file auth.py.

def tornado.auth.FriendFeedMixin._oauth_get_user_future (   self,
  access_token,
  callback 
) [private]
Subclasses must override this to get basic information about the
user.

Should return a `.Future` whose result is a dictionary
containing information about the user, which may have been
retrieved by using ``access_token`` to make a request to the
service.

The access token will be added to the returned dictionary to make
the result of `get_authenticated_user`.

For backwards compatibility, the callback-based ``_oauth_get_user``
method is also supported.

Reimplemented from tornado.auth.OAuthMixin.

Definition at line 869 of file auth.py.

def tornado.auth.FriendFeedMixin._on_friendfeed_request (   self,
  future,
  response 
) [private]

Definition at line 853 of file auth.py.

def tornado.auth.FriendFeedMixin._parse_user_response (   self,
  callback,
  user 
) [private]

Definition at line 877 of file auth.py.

def tornado.auth.FriendFeedMixin.friendfeed_request (   self,
  path,
  callback,
  access_token = None,
  post_args = None,
  args 
)
Fetches the given relative API path, e.g., "/bret/friends"

If the request is a POST, ``post_args`` should be provided. Query
string arguments should be given as keyword arguments.

All the FriendFeed methods are documented at
http://friendfeed.com/api/documentation.

Many methods require an OAuth access token which you can
obtain through `~OAuthMixin.authorize_redirect` and
`~OAuthMixin.get_authenticated_user`. The user returned
through that process includes an ``access_token`` attribute that
can be used to make authenticated requests via this
method.

Example usage::

    class MainHandler(tornado.web.RequestHandler,
              tornado.auth.FriendFeedMixin):
@tornado.web.authenticated
@tornado.gen.coroutine
def get(self):
    new_entry = yield self.friendfeed_request(
        "/entry",
        post_args={"body": "Testing Tornado Web Server"},
        access_token=self.current_user["access_token"])

    if not new_entry:
        # Call failed; perhaps missing permission?
        yield self.authorize_redirect()
        return
    self.finish("Posted a message!")

Definition at line 797 of file auth.py.


Member Data Documentation

string tornado::auth.FriendFeedMixin::_OAUTH_ACCESS_TOKEN_URL = "https://friendfeed.com/account/oauth/access_token" [static, private]

Definition at line 791 of file auth.py.

string tornado::auth.FriendFeedMixin::_OAUTH_AUTHORIZE_URL = "https://friendfeed.com/account/oauth/authorize" [static, private]

Definition at line 792 of file auth.py.

Definition at line 793 of file auth.py.

string tornado::auth.FriendFeedMixin::_OAUTH_REQUEST_TOKEN_URL = "https://friendfeed.com/account/oauth/request_token" [static, private]

Definition at line 790 of file auth.py.

string tornado::auth.FriendFeedMixin::_OAUTH_VERSION = "1.0" [static, private]

Definition at line 789 of file auth.py.


The documentation for this class was generated from the following file:


rosbridge_server
Author(s): Jonathan Mace
autogenerated on Thu Aug 27 2015 14:50:40