Skip to main content

A tornado based facebook graph api wrapper

Project description

What is it?

The tornado-facebook-sdk is a library that aims to ease the task of writing non-blocking, server side, facebook social graph accessing code. It’s built using tornado. This makes tornado-facebook-sdk a perfect fit if you’re developing an application using tornado.

Installing

The prefered way to install is via pip

$ pip install tornado-facebook-sdk

From github, for the last version

$ pip install git+https://github.com/pauloalem/tornado-facebook-sdk.git

Or you can just download it and install via setup.py, it’s up to you.

Using

Getting facebook’s public page

from tornado import ioloop
from facebook import GraphAPI

ioloop = ioloop.IOLoop.instance()
graph = GraphAPI()

# a simple callback that prints social graph responses
def print_callback(data):
    print data
    ioloop.stop()

graph.get_object('/facebook', callback=print_callback)

ioloop.start()

Authenticating with a user auth token and printing it’s name

graph = GraphAPI(access_token)

#do something with the user's data, like print it's first name
def get_first_name(me):
    print me['first_name']
    ioloop.stop()

result = graph.get_object('/me', callback=get_first_name)
ioloop.start()

Posting on an user’s wall

def callback(response):
    # ...
graph.post_wall("Maoe!", callback=callback)

Which is just a shortcut for

def callback(response):
    # ...
graph.put_object('me', 'feed', message="Maoe!!", callback=callback)

Deleting an object

def callback(response):
    # ...
graph.delete_object(obj_id, callback=callback)

License

Read LICENSE.txt

History

This library is based on the facebook-sdk library. Originaly, I was going to use it as it’s simple and has a nice interface, but it’s blocking code makes it a no-no.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tornado-facebook-sdk-0.1.0.tar.gz (3.9 kB view details)

Uploaded Source

File details

Details for the file tornado-facebook-sdk-0.1.0.tar.gz.

File metadata

File hashes

Hashes for tornado-facebook-sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 766ee6a353239117142b01c5287b2b6f0b822f405c29a1374de2e2fc95178591
MD5 7c444c7330208cae4093ab73d8ad01cf
BLAKE2b-256 3cd0d2d544a85bdc21d384e4665b3ed5dd296611d4ba27524184d7055c90c5ad

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page