Skip to content
This repository

Facebook Platform Python SDK

branch: master

Documentation updates.

This improves the existing documentation, but does not extend it
sufficiently. More improvement is still needed.
latest commit e30370fa71
Martey Dodoo martey authored
Octocat-spinner-32 docs Explicitly state package name in install docs. March 30, 2014
Octocat-spinner-32 examples PEP8 changes for updated appengine example. December 18, 2012
Octocat-spinner-32 facebook Fix version string integration. February 09, 2014
Octocat-spinner-32 test Rename `tests` directory to `test`. February 10, 2014
Octocat-spinner-32 .gitignore Updating .gitignore. October 17, 2013
Octocat-spinner-32 .travis.yml Rename `tests` directory to `test`. February 10, 2014
Octocat-spinner-32 CONTRIBUTING.rst Point CONTRIBUTING.rst at docs. March 30, 2014
Octocat-spinner-32 MANIFEST.in Convert readme to ReStructuredText. October 15, 2012
Octocat-spinner-32 README.rst Update README.rst March 30, 2014
Octocat-spinner-32 setup.py Something not working with setup.py package_dir February 10, 2014
README.rst

Facebook Python SDK

This client library is designed to support the Facebook Graph API and the official Facebook JavaScript SDK, which is the canonical way to implement Facebook authentication. You can read more about the Graph API by accessing its official documentation.

Basic usage:

import facebook
graph = facebook.GraphAPI(oauth_access_token)
profile = graph.get_object("me")
friends = graph.get_connections("me", "friends")
graph.put_object("me", "feed", message="I am writing on my wall!")

Photo uploads:

graph = facebook.GraphAPI(oauth_access_token)
tags = json.dumps([{'x':50, 'y':50, 'tag_uid':12345}, {'x':10, 'y':60, 'tag_text':'a turtle'}])
graph.put_photo(open('img.jpg'), 'Look at this cool photo!', album_id_or_None, tags=tags)

If you are using the module within a web application with the JavaScript SDK, you can also use the module to use Facebook for login, parsing the cookie set by the JavaScript SDK for logged in users. For example, in Google AppEngine, you could get the profile of the logged in user with:

user = facebook.get_user_from_cookie(self.request.cookies, key, secret)
if user:
    graph = facebook.GraphAPI(user["access_token"])
    profile = graph.get_object("me")
    friends = graph.get_connections("me", "friends")

You can see a full AppEngine example application in examples/appengine.

Reporting Issues

If you have bugs or other issues specifically pertaining to this library, file them here. Bugs with the Graph API should be filed on Facebook's bugtracker.

Support & Discussion

Documentation is available at https://facebook-sdk.readthedocs.org/en/latest/.

Have a question? Need help? Visit the library's Google Group.

Something went wrong with that request. Please try again.