0
我目前正在尝试使用PyFacebook检索当前使用应用程序的朋友列表。下面的Python代码,我可以进行登录后获取的与他们的名字和朋友的UID整个列表:如何使用PyFacebook检索当前使用应用程序的朋友?
# Desktop Application example
def desktop_app():
from facebook import Facebook
# Get api_key and secret_key from a file
facebook = Facebook('API_KEY','SECRET_KEY')
facebook.auth.createToken()
# Show login window
facebook.login()
# Login to the window, then press enter
print 'After logging in, press enter...'
raw_input()
facebook.auth.getSession()
info = facebook.users.getInfo([facebook.uid], ['name', 'birthday', 'affiliations','sex'])[0]
for attr in info:
print '%s: %s' % (attr, info[attr])
friends = facebook.friends.get()
friends = facebook.users.getInfo(friends[0:], ['name', 'birthday'])
for friend in friends:
if 'birthday' in friend:
print friend
if __name__=="__main__":
desktop_app()
这是伟大的,但现在我只需要谁正在使用的应用程序与朋友指定的API_KEY和SECRET_KEY。有没有人知道如何在PyFacebook中做到这一点?