Facebook中是否有图表Api模块

时间:2012-09-16 18:06:59

标签: python pyfacebook

我已经安装了pyfacebook以及python sdk,即使我收到错误如下

使用此代码时

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

我面临的错误是

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

1 个答案:

答案 0 :(得分:1)

使用facebook安装easy_install facebook模块时出现此问题。当我运行以下内容时它起作用了:

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