我已经尝试了类似问题等的一些建议。这些都没有帮助我的情况。
我在具有 Python 解决方案的 Google App Engine 中使用根据 Apache 许可证获得许可的 Facebook.py。
我已经使用我的有效访问令牌创建了 GraphAPI 对象。它显示在 App Engine 日志中:
Graph >>> facebook.GraphAPI object at 0x64cc19e10b2ceb90
因此,创建 GraphAPI 对象后,
graph.put_object('Valid Facebook User ID', "feed",
message="Hello world", link="http://example.com")
这是抛出错误日志,如下所示:
HTTP Error 400: Bad Request:
Traceback (most recent call last):
File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/webapp/_webapp25.py", line 701, in __call__
handler.get(*groups)
File "/base/data/home/apps/s~/development.358229427391780612/handler/profile_handlers.py", line 401, in get
graph.put_object(self.user.user_id, "feed", message="Hello world", link="http://example.com")
File "/base/data/home/apps/s~/development.358229427391780612/facebook.py", line 129, in put_object
return self.request(parent_object + "/" + connection_name, post_args=data)
File "/base/data/home/apps/s~/development.358229427391780612/facebook.py", line 181, in request
file = urllib2.urlopen(graphUrl, post_data)
File "/base/python_runtime/python_dist/lib/python2.5/urllib2.py", line 124, in urlopen
return _opener.open(url, data)
File "/base/python_runtime/python_dist/lib/python2.5/urllib2.py", line 387, in open
response = meth(req, response)
File "/base/python_runtime/python_dist/lib/python2.5/urllib2.py", line 498, in http_response
'http', request, response, code, msg, hdrs)
File "/base/python_runtime/python_dist/lib/python2.5/urllib2.py", line 425, in error
return self._call_chain(*args)
File "/base/python_runtime/python_dist/lib/python2.5/urllib2.py", line 360, in _call_chain
result = func(*args)
File "/base/python_runtime/python_dist/lib/python2.5/urllib2.py", line 506, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 400: Bad Request
最初,我将大量附加数据作为附件(链接、描述等)。但是,在减少附件元素之后,它仍然会抛出相同的错误。而且,我正在使用 put_wall_post 的方法。有些人建议改用 put_object。
尝试在论坛中搜索了很多,但仍然无法解决一些建议的问题。
知道主要问题是什么吗?