8

I decide to write some applications using facebook and django (or even twisted, but it doesn't matter), and now I can't choose appropriate tools. I see there are many API-wrappers writed on Python exists for Facebook:

  • official, but seems no longer supported Python-SDK
  • new and actively developed, but seems too new Django-facebook
  • good old, but not maintained pyfacebook
  • simple, well-maintaned, but non-documented fandjango
  • some other very primitive tools

I saw some similar questions here, but I'm noticed that Facebook is periodically introduces big changes into their API and those advices may be already outdated, or may be new libraries appeared. Also I'd like to know about most significant differences between those libraries. And of course good documentation and tutorials are welcome.

Community
  • 1
  • 1
chuwy
  • 6,310
  • 4
  • 20
  • 29

3 Answers3

10

I think Django Facebook is a good choice for you. But my opinion is biased. I've written it for my startup Fashiolista.com and we run it in production. (Quite huge, so most edge cases have been resolved)

Django Facebook also include OpenFacebook, which is a python api client to the open graph protocol. It's the only python client I know which is fully up to date and actively maintained.

Have a look at: https://github.com/tschellenbach/Django-facebook

PS. Just released some new decorators which make it very simple to get started. These decorators are indeed very new and caused some bugs in the past days. The project itself is already a year old (since the open graph api was released) and otherwise quite stable. http://www.mellowmorning.com/

Thierry
  • 3,225
  • 1
  • 26
  • 26
  • Thierry, does django-facebook allow(or provides ways) to integrate regular Django site with facebook? I mean so that *not* canvas app is used, but that in plain site Django account is linked to FB account and e.g. one can post to his wall from a regular Django app. – AlexA May 31 '12 at 19:41
5

The answer really depends on what it is you want to achieve as those APIs are pretty different.

  • pyfacebook - is for the older legacy API.

  • python-sdk - is for the "new" opengraph protocol (I wouldn't say its no longer supported as its just a thin wrapper over the facebook opengraph protocol, so supports all the new features that facebook provide instantly w/out needing dev work on the lib).

  • django-facebook - is a higher level than python-sdk and helps you to add facebook connection features to your site and also seems to pave the way to creating apps that live "inside" facebook rather than just helping sites that live outside facebook to get access to facebook data.

  • Never heard of fandjango and github seems to be down at the moment so can't comment on that.

If you just want to add user-login using facebook then something like django-socialauth might work out well for you.

If you want to start exploring the social graph then python-sdk is the way to go.

I'd also check to see if the functions you want are supported by the opengraph protocol, its improved over the last year but there is the odd thing it frustratingly doesn't support whereas the legacy api does support...

The best documentation is facebook itself, check out the graph-explorer - it's pretty fascinating...

jawache
  • 830
  • 1
  • 9
  • 15
  • 1
    I'm looking at python-sdk, and it appears to be a wrapper on top of the JavaScript SDK. Does Facebook expect us to always use the JavaScript API now? The FB documentation suggest that you can still do server side auth, though following their instructions [doesn't work for me](http://stackoverflow.com/questions/8001628/cant-oauth-with-facebook-what-are-my-next-debugging-steps). – ObscureRobot Nov 03 '11 at 22:32
  • @ObscureRobot You might want to specify your problem as a separate question. I have written a Facebook api of my own and it does work from server side. Moreover calling Facebook Javascript SDK is just an add on to sometimes makes things easier without having to go roundtrip via server side. For any instantaneous queries javascript SDK is a better choice. Server side calls help when you would like to cache the results fetched from facebook. – Divick Aug 01 '12 at 14:56
  • @DivKis01 - that's what I did, the separate question is linked with the words "doesn't work for me" that finish my comment above. Turns out the problem was an error on my part. – ObscureRobot Aug 01 '12 at 16:08
1

It depends what you are trying to do. I had the same problem and ended up using django-social-auth , which lets you log in via Facebook and many other social networks.It also lets you extract the token from those networks and then use it.

For the facebook specific stuff, I use facebook-sdk, but since you have something managing the tokens, you could really replace it with any library if yours become outdated in upcoming years . It also means you can add more social networks later on.

GuySoft
  • 1,723
  • 22
  • 30