我正在使用Python facebook-sdk在 Facebook 页面中获取用户的帖子。
在 facebook Graph api explorer 中,请求进展顺利:
Get .../coldplay/feed?limit=2
在我的程序中,请求:
In [27]: graph = facebook.GraphAPI("...")
In [28]: posts = graph.get_object('coldplay/feed?limit=2')
报告错误:
GraphAPIError Traceback (most recent call last)
/home/ubuntu/<ipython console> in <module>()
/usr/local/lib/python2.7/dist-packages/facebook.pyc in get_object(self, id, **args)
97 def get_object(self, id, **args):
98 """Fetchs the given object from the graph."""
---> 99 return self.request(id, args)
100
101 def get_objects(self, ids, **args):
/usr/local/lib/python2.7/dist-packages/facebook.pyc in request(self, path, args, post_args)
296 except urllib2.HTTPError, e:
297 response = _parse_json(e.read())
--> 298 raise GraphAPIError(response)
299 except TypeError:
300 # Timeout support for Python <2.6
如果我要求没有“?limit = 2”,则程序运行良好:
In [45]: graph = facebook.GraphAPI("...")
In [46]: posts = graph.get_object('coldplay/feed')
In [47]: len(posts)
Out[47]: 2
所以我想知道如何提出请求:'.../feed?limit=2' 适用于 Python facebook-sdk?谢谢。