'Makes a Facebook API REST request.
We automatically include the Facebook API key and signature, but
it is the callers responsibility to include \'session_key\' and any
other required arguments to the method.
The available Facebook methods are documented here:
http://wiki.developers.facebook.com/index.php/API
Here is an example for the stream.get() method::
class MainHandler(tornado.web.RequestHandler,
tornado.auth.FacebookMixin):
@tornado.web.authenticated
@tornado.web.asynchronous
def get(self):
self.facebook_request(
method="stream.get",
callback=self._on_stream,
session_key=self.current_user["session_key"])
def _on_stream(self, stream):
if stream is None:
# Not authorized to read the stream yet?
self.redirect(self.authorize_redirect("read_stream"))
return
self.render("stream.html", stream=stream)'

def facebook_request(self, method, callback, **args):

    self.require_setting('facebook_api_key', 'Facebook    Connect')
    self.require_setting('facebook_secret', 'Facebook    Connect')
    if (not method.startswith('facebook.')):
        method = ('facebook.' + method)
    args['api_key'] = self.settings['facebook_api_key']
    args['v'] = '1.0'
    args['method'] = method
    args['call_id'] = str(long((time.time() * 1000000.0)))
    args['format'] = 'json'
    args['sig'] = self._signature(args)
    url = ('http://api.facebook.com/restserver.php?' + urllib_parse.urlencode(args))
    http = self.get_auth_http_client()
    http.fetch(url, callback=functools.partial(self._parse_response, callback))
