Skip to content
facebook development kit for Django
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

readme.markdown is a software development kit for Facebook. It supports both old rest api and new graph api. it uses oauth, old style signature/secretkey based api calls for old rest api are not supported at this time.

you can find official documentation at facebook about api calls and methods.

1) old rest api: 2) graph api:


1) python-simplejson


1) get the archive. 2) run python install (with root priviliges)

usage in Django

1) add these lines to your

    "redirect_uri"     : "%s/fbconnect" % BASE_URL,
    "scope"            : 'email,publish_stream,offline_access,user_hometown,user_location',
    "api_key"          : "[INSERT_API_KEY_HERE]",
    "app_secret"       : "[INSERT_APPLICATION_SECRET_HERE]",
    "app_id"           : "[INSERT_APPLICATION_ID_HERE]",

2) add to your MIDDLEWARE_CLASSES:


5) after these steps, you can call FBPY instance as request.facebook. a simple view example:

if not request.facebook.is_authenticated():
    return HttpResponseRedirect(request.facebook.get_login_url())
    user_info = request.facebook.graph().get_object("me")
    return render_to_response("welcome.html", user_info, context_instance = RequestContext(request))

6) read the code/wait for more documentation. is one python file with inline documentation, so browsing the code is a good idea than waiting a fully documentation.

installation of "example_project"

1) there is a sandbox django project in example_project directory.

2) download it and edit (FACEBOOK_CONFIG variable.)

3) run python syncdb (we need sessions!)

4) run python runserver

5) go to your web browser, and see

low level api

1) in order to send calls to new graph api, a simple request should be like that: reply = request.facebook.graph().get_object("me")

2) old rest api example: (taking mutual friends for a spesific profile id) reply ="friends.getMutualFriends", target_uid = profile_id)

3) happy hacking!


1) more documentation.

2) handling cookie/session storage in FBPY.


1) Timu Eren & Yilmaz Ugurlu - suggestions and ideas.

for donations:

Click here to lend your support to: donate for updated and new version and make a donation at !

Something went wrong with that request. Please try again.