[英]facepy.exceptions.FacebookError while trying to post
I am startingto learn facepy and when I tried to post from facepy, I get an error. 我开始学习facepy,当我试图从facepy发布时,我收到一个错误。 But I can get post details.
但我可以得到帖子的详细信息。 My code:
我的代码:
>>> from facepy import GraphAPI
>>>g = GraphAPI('my_token')
>>> g.get(506482556089521)['from']
{u'name': u'Aswin Murugesh', u'id': u'100001833444044'}
>>> g.post(
... path = 'me/posts',
... message = 'Hello'
... )
Traceback (most recent call last):
File "<stdin>", line 3, in <module>
File "/usr/local/lib/python2.7/dist-packages/facepy/graph_api.py", line 65, in post
retry = retry
File "/usr/local/lib/python2.7/dist-packages/facepy/graph_api.py", line 237, in _query
return load(method, url, data)[0]
File "/usr/local/lib/python2.7/dist-packages/facepy/graph_api.py", line 201, in load
result = self._parse(response.content)
File "/usr/local/lib/python2.7/dist-packages/facepy/graph_api.py", line 279, in _parse
error.get('code', None)
facepy.exceptions.FacebookError
Why do I get this error? 为什么我会收到此错误?
Because you not post message that response from facebook 因为你没有发布消息来自facebook的回复
What I see that you miss is 我看到你错过的是
>>> g.post(
... path = 'me/posts',
... message = 'Hello'
... )
You use incorrect path. 您使用不正确的路径。 If you debug the error you will got
如果您调试错误,您将获得
{
"error": {
"message": "Unsupported post request.",
"type": "GraphMethodException",
"code": 100
}
}
The correct path to post a message to your wall is me/feed
You can test it here https://developers.facebook.com/tools/explorer/?method=POST&path=me%2Ffeed 将消息发布到墙上的正确路径是
me/feed
你可以在这里测试它https://developers.facebook.com/tools/explorer/?method=POST&path=me%2Ffeed
>>> g.post(
... path = 'me/feed',
... message = 'Hello'
... )
If it still get the error, your problem might be not have publish_stream
permission 如果仍然出现错误,则您的问题可能没有
publish_stream
权限
For more information : https://developers.facebook.com/docs/reference/api/publishing/ 有关更多信息,请访问: https : //developers.facebook.com/docs/reference/api/publishing/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.