Facebook Query Language using python -


i used following query in https://developers.facebook.com/tools/explorer?fql=

select aid album owner = "100001741044617"; 

and got right output.

i tried using same query via python , extract output getting problem. posting python code , output

code:

import urllib query = "select aid album owner = \"100001741044617\"" print(query) query = urllib.quote(query) print(query) url = "https://graph.facebook.com/fql?q=" +query  data = urllib.urlopen(url).read() print(data) 

output

[root@in-air-bimapp106 ~]# python /opt/fql.py  select aid album owner = "100001741044617" select%20aid%20from%20album%20where%20owner%20%3d%20%22100001741044617%22 {"error":{"message":"a user access token required request resource.","type":"oauthexception","code":102}} 

i have generated required access token user_photoes. kindly let me know do. thanks.

the access token needs included in query. example, friends:

query = "select uid2 friend uid1 = me()" params = urllib.urlencode({'q': query, 'access_token': your_access_token}) print params  'q=select+uid2+from+friend+where+uid1+%3d+me%28%29&access_token=your_access_token'  url = "https://graph.facebook.com/fql?" + params data = urllib.urlopen(url).read() print(data)  '{"data":[{"uid2":"#######"},{"uid2":"#######"},{"uid2":"#######"}, ... 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -