What is the best library to access Facebook Graph API data for python 2.7 or python 3.0?
I'm new to the Facebook Graph API. Doing some research, in the past people used pyfacebook and the Facebook Python SDK, but it seems neither are being updated / supported anymore. What are people currently using to access the data? Is there one that's independent of a platform / framework?
People use SDKs. It's the most manageable way to do it.
The Python SDK (facebook) is up to date and has a repo at https://github.com/pythonforfacebook/facebook-sdk. It's not official because Facebook doesn't officially support anymore but it is maintained (last commit 12 days ago) and people do use it.
facepy as well is actively maintained https://github.com/jgorset/facepy. facepy's interface is very hands on and is a light wrapper on the API (pretty much you have access to the raw API) where as Python SDK is more integrated.
For example,
Photo Upload
Python SDK
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)
Facepy
graph = GraphAPI(oauth_access_token)
graph.post(
path = 'me/photos',
source = open('parrot.jpg')
)
Notice the .put_photo
vs me/photos
of which the latter resembles the native Graph API call.
Also there is Django Facebook http://django-facebook.readthedocs.org/en/latest/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With