from fqlpy import FqlApi APP_ID='<YOUR APP_ID HERE>' APP_SECRET='<YOUR APP_SECRET HERE>' access_token='<A USER ACCESS TOKEN HERE>' # NOTE: look at samplePhpToGetUserAccessToken.php on how to get a user access token # and note that you DON'T need to get the access token from the same server fb=FqlApi(APP_ID,APP_SECRET) fb.setAccessToken(access_token) data=fb.runFQL('SELECT uid,user_likes,friends_likes FROM permissions WHERE uid=me()'); item=data[0] uid=item['uid'] user_likes_perm=item['user_likes'] friends_likes_perm=item['friends_likes'] if not user_likes_perm: print 'Not allowed to get current user likes' else: data=fb.runFQL('SELECT url FROM url_like WHERE user_id='+str(uid)) for item in data: print 'Current user likes ',item['url'] #################################################### ## BATCH REQUEST FOR FRIENDS #################################################### def getUserNames(uids): # batch calls to 50 items per batch USER_LIMIT_PER_CALL=50 if len(uids)>USER_LIMIT_PER_CALL: result=getUserNames(uids[USER_LIMIT_PER_CALL:]) for (uid,name) in getUserNames(uids[:USER_LIMIT_PER_CALL]).items(): result[uid]=name
from fqlpy import FqlApi APP_ID='<YOUR APP_ID HERE>' APP_SECRET='<YOUR APP_SECRET HERE>' fb=FqlApi(APP_ID,APP_SECRET) # app access token needed to read public data fb.setAppAccessToken() # get id of page http://www.facebook.com/pythonlang data=fb.runFQL('SELECT page_id FROM page WHERE username="******"') page_id=data[0]['page_id'] # print messages data=fb.runFQL('SELECT message FROM stream WHERE source_id='+str(page_id)) for item in data: print item['message'].encode('utf8')