Pyfb – A Brand New Interface To The Facebook Graph API

I Just started a new way to communicate our python applications with the Facebook Graph API.

It’s a easy to use API wrapper that provides you objects instead of dictionaries (Wich is what facebook’s API returns).

You can do cool stuff like:

from pyfb import Pyfb

#Your APP ID. You Need to register the application on facebook
#http://developers.facebook.com/
FACEBOOK_APP_ID = 'YOUR_APP_ID'

facebook = Pyfb(FACEBOOK_APP_ID)

#Opens a new browser tab instance and authenticates with the facebook API
#It redirects to an url like http://www.facebook.com/connect/login_success.html#access_token=[access_token]&expires_in=0
facebook.authenticate()

#Copy the [access_token] and enter it below
token = raw_input("Enter the access_token\n")

#Sets the authentication token
facebook.set_access_token(token)

#Gets info about myself 
me = facebook.get_myself()

print "-" * 40
print "Name: %s" % me.name
print "From: %s" % me.hometown.name
print 

print "Speaks:"
for language in me.languages:
    print "- %s" % language.name

print     
print "Worked at:"
for work in me.work:
    print "- %s" % work.employer.name

print "-" * 40

The package is available on pypi:

sudo pip install pyfb

And the code is hosted at:

http://github.com/jmg/pyfb

I wish it was usefull for you!

Regards,
Juan Manuel