Write Facebook apps using Google AppEngine Apr 20

I hacked up minifb in order to get it to work with Google AppEngine. The result is gminifb. It uses Google's urlfetch library instead of urllib2.

To get it to work, download gminifb and place it in your application's directory. It requires simplejson, so put that in your app's directory as well.

Here's a sample webapp.py action that uses the library:

class FacebookAction(FbHandler):
  def get(self):
    arguments = gminifb.validate(FB_SECRET_KEY, self.request)
    session_key = arguments["session_key"]
    uid = arguments["user"]

    usersInfo = gminifb.call("facebook.users.getInfo",
        FB_API_KEY, FB_SECRET_KEY, session_key=session_key,
        call_id=True, fields="name,pic_square",
        uids=uid) # uids can be comma separated list
    name = usersInfo[0]["name"]
    photo = usersInfo[0]["pic_square"]

    self.render('facebook.html', {'name': name, 'photo': photo})

Thanks to Peter Shinners for writing the original minifb library. My changes were very minimal...

Add a comment

Add a comment

Name (required)
Email (won't be displayed)
URL (include http://)
Comment (required)