· 6 years ago · Feb 09, 2019, 09:52 PM
1import facebook
2import sys
3import codecs
4api_key = 'API_KEY'
5secret_key = 'API_SECRET'
6client = facebook.Facebook(api_key, secret_key)
7client.auth.createToken()
8client.login()
9print '[*] Please login / give permission application to access you . Then press enter key to continue...'
10raw_input()
11
12try:
13 client.auth.getSession()
14 client.request_extended_permission("publish_stream", popup=False)
15 raw_input()
16 print "n"
17 info = client.users.getInfo([client.uid], ['name', 'birthday', 'affiliations', 'sex'])[0]
18 for attr in info:
19 print '%s: %s' % (attr, info[attr])
20 friends = client.friends.get()
21 n=len(friends)
22 frnds = client.users.getInfo(friends[0:100], ['uid'])
23 for uid in frnds:
24 f= uid.friends.get()
25 frnd = uid.users.getInfo(f[0:100], ['name', 'birthday', 'sex' , 'relationship_status','interests'])
26 for friend in frnd:
27 print friend['name'], 'has a birthday on', friend['birthday'], 'and is', friend['relationship_status'],'has interst in',"t",friend['interests']
28except facebook.FacebookError, e:
29 print "ERROR", e
30
31ERROR Error 200: User does not have sufficient administrative permission for this action on this page