【发布时间】:2014-04-30 13:15:02
【问题描述】:
我正在尝试使用 facebook api 访问我的 facebook 个人资料。我的python代码如上:
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!")
我已经创建了一个 facebook 应用程序,我有应用程序 ID 和 sexret。但是我不知道如何访问 oauth_access_token。有什么想法吗?
我找到了这个example> 但是,我收到了以下信息:
{
"error": {
"message": "Invalid redirect_uri: \u039f\u03b9 \u03c0\u03b1\u03c1\u03ac\u03bc\u03b5\u03c4\u03c1\u03bf\u03b9 \u03c4\u03b7\u03c2 \u03b5\u03c6\u03b1\u03c1\u03bc\u03bf\u03b3\u03ae\u03c2 \u03b4\u03b5\u03bd \u03b5\u03c0\u03b9\u03c4\u03c1\u03ad\u03c0\u03bf\u03c5\u03bd \u03c4\u03b7 \u03c3\u03c5\u03b3\u03ba\u03b5\u03ba\u03c1\u03b9\u03bc\u03ad\u03bd\u03b7 \u03b4\u03b9\u03b5\u03cd\u03b8\u03c5\u03bd\u03c3\u03b7 URL.",
"type": "OAuthException",
"code": 191
}
}
编辑:我从here 获取访问令牌。它返回给我用户和应用程序令牌。所以我使用以下代码在我的 facebook 帐户中发布:
import facebook
oauth_access_token = "****"
graph = facebook.GraphAPI(oauth_access_token)
me = "****"
profile = graph.get_object(me)
graph.put_object(me, "feed", message="I am writing on my wall!")
acces_token 和我必须放入什么???
【问题讨论】:
标签: python facebook user-interface token