我正试图从我的网站上发布到我的脸书墙。我已经用Facebook登录了我的网站,并且还授予了publish_actions许可,但是当我试图发布到Facebook时,我会出错。
Facebook说,我可以通过发出HTTP请求到用户的墙上,如下所示:
POST graph.facebook.com
/{user-id}/feed?
message={message}&
access_token={access-token}user-id、message和access-token令牌是长期存在的,正如Facebook API调用响应所返回的那样,它们都是正确的。
我还有pip install requests,一个优雅而简单的Python HTTP库,为人类构建
我的代码:
import requests
if user.publish:
message = post_message.encode('utf8')
url = "https://graph.facebook.com/{0}/feed".format(user.facebook_id)
msg = {'message':message, 'access_token':user.access_token }
r = requests.post(url, data=json.dumps(msg))
return HttpResponse(r)代码返回以下错误:
{"error":{"message":"Unsupported发布请求。请阅读https://developers.facebook.com/docs/graph-api","type":"GraphMethodException","code":100}}的图形API文档。
发布于 2015-07-09 05:57:49
我想你是向错误的网址提出要求,应该是
url = "https://graph.facebook.com/me/feed"此外,facebook不允许应用程序在好友墙上发布帖子。你只能在你的墙上发布帖子。
https://stackoverflow.com/questions/31295721
复制相似问题