×

Sign in with twitter.

You can follow the user and hashtags.

Share your tips on social media.

Post relative tips.

If you have relative tips, click [Add relative tips] to post.

Python で Facebook API の fql.multi する例

@astronaughts@astronaughts 1071 viewer 38 embed viewer embed
# Facebook API なクラスのお供に。

import urllib
import simplejson

def fql_multi(self, access_token, **queries):
args = {
'queries': simplejson.dumps(queries),
'format': 'json',
'access_token': access_token
}
contents = urllib.urlopen('https://api.facebook.com/method/fql.multiquery?' + urllib.urlencode(args))
return simplejson.loads(contents.read())

result_sets = fql_multi(
ACCESS_TOKEN,
q1 = 'SELECT post_id, created_time FROM stream WHERE source_id = me()',
q2 = 'SELECT user_id FROM like WHERE post_id in (SELECT post_id FROM #q1)',
q3 = 'SELECT fromid FROM comment WHERE post_id in (SELECT post_id FROM #q1)',
)

print result_sets

Click this to change format.

Add relative tips

Users who share this tip.

Comments