Facebook API Python

0

Can I list ALL the groups of a friend on the face? Type show what groups it is?

I found this code but it's not what I want, it just shows my friends:

import urllib2
import json
url = 'https://graph.facebook.com/me/friends?access_token=TOKEN'
resp = urllib2.urlopen(url).read()
data = json.loads(resp.decode('utf-8'))
for amigo in data['data']:
   print (amigo['name'])
    
asked by anonymous 23.10.2015 / 16:33

1 answer

0

Tried to replace friends by groups in the url? Remember that to access this information, the user must authorize access. In your app configuration, you must access the permissions and register that you are requesting the user groups:

More information: link

To work with facebook, you can also use facepy:

pip install facepy

It's much simpler to get user information:

from facepy import GraphAPI

graph = GraphAPI('token_usuario')
data = graph.get('me?fields=id,email,name')
#data {u'id': u'11111111', u'name': u'Puam Dias'}
    
23.10.2015 / 17:59