GraphApi module present in pyfacebook or not

吃可爱长大的小学妹 提交于 2019-12-10 10:08:39

问题


i have installed pyfacebook as well as python sdk even the i am getting error as follows

when using this code

import facebook
token = 'my token'
graph = facebook.GraphAPI(token)
profile = graph.get_object("me")
friends = graph.get_connections("me", "friends")
friend_list = [friend['name'] for friend in friends['data']]
print friend_list

    

error that i am facing is

graph = facebook.GraphAPI(token)
AttributeError: 'module' object has no attribute 'GraphAPI'

回答1:


I had this problem when I install the facebook module using easy_install facebook. It worked when I ran the following instead:

git clone https://github.com/pythonforfacebook/facebook-sdk.git pip install facebook-sdk



来源:https://stackoverflow.com/questions/12449335/graphapi-module-present-in-pyfacebook-or-not

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!