#!/usr/bin/python
import facebook
import facepy
from facepy import GraphAPI
graph = facebook.GraphAPI(oauth_access_token)
profile = graph.get_object("me")
friends = graph.get_connections("me", "friends")
friends = graph.get_connections(" me"," friends") Traceback(最近一次调用最后一次): 文件"",第1行,in AttributeError:' GraphAPI'对象没有属性' get_connections'
答案 0 :(得分:1)
PyPI上的Facebook软件包搞砸了。它不是你想要的facebook,而是facebook-sdk。
确保你有合适的人:
pip uninstall facebook # Remove the broken package
pip install facebook-sdk # Install the correct one
答案 1 :(得分:0)
您必须在FaceBook上注册oauth_access_token:link。
基本用法:
import facebook
graph = facebook.GraphAPI(oauth_access_token)
profile = graph.get_object("me")
friends = graph.get_connections("me", "friends")
graph.put_object("me", "feed", message="I am writing on my wall!")
参考书目:
- pythonforfacebook / facebook-sdk http://goo.gl/mUuIH
- FB SDK第三方http://goo.gl/rNFyW4
醇>