Facebook Tutorial: Python for Facebook or PyFacebook tutorial

facebook_pyfacebook.jpg

In this tutorial provided by the facebook developers website, you will learn to use the pyfacebook interface which is a Python interface to the Facebook API.

 

When uploaded and installed, you just need to the call the new interface in your scripts by adding a line at the top of your script like:

import facebook

And you may enjoy the facebook functions directly. For example:


fb = facebook.Facebook('YOUR_API_KEY', 'YOUR_SECRET_KEY')

or
fb.auth.createToken()
or even
fb.login()

fb.auth.getSession()

For instance Following is a code sample:

import facebook

api_key = 'YOUR_API_KEY'
secret_key = 'YOUR_SECRET_KEY'
session_key = 'YOUR_SESSION_KEY'

fb = facebook.Facebook(api_key, secret_key)
fb.session_key = session_key

fb.profile.setFBML('Woot!‘, ‘USER_ID‘)

You may even use Pyfacebook with Django (a Python Web framework).

 

If you don’t know yet how to program with Python, you will probably want to learn it so easy it is to integrate!

Source page

Tags: , , , ,

Related Post

No Comments

No comments yet.

Comments RSS TrackBack Identifier URI

Leave a comment