- This fork is still in development:
- TODO:
put_photo isn’t working yet. shortcuts out of GraphAPI class aren’t tested
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:
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.
Release files for geventhttpclient-facebook 0.4.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| geventhttpclient-facebook-0.4.4.tar.gz | 14.7 kB | Details |
Release files / geventhttpclient-facebook-0.4.4.tar.gz
| Download URL | geventhttpclient-facebook-0.4.4.tar.gz |
|---|---|
| Size | 14.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
37b055a8b0fd2605058623254875de373b9e33ec9c7f1877c8a0455fd42410fc
|
|
BLAKE2b-256 checksum How to use checksums |
f0ec5d6d4741f1fe1b4adf7918596e6ce1aca421d511b2018a463f0534c25bfd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |