我知道这很简单,但我无法弄清楚。尝试按名称搜索用户。
import facebook
graph = facebook.GraphAPI(token)
graph.request(#HAVING PROBLEMS)
来自文档:
def request(self, path, args=None, post_args=None, files=None, method=None)
graph.request('/search')
得到了这一部分。回复是no node specified
。
如果我尝试graph.request('/search', 'any string at all')
,例如:
graph.request('/search', 'my name') #or
graph.request('/search', 'name=whatever')
我明白了:
File "C:\Python27\lib\site-packages\facebook.py", line 291, in request
args["access_token"] = self.access_token
TypeError: 'str' object does not support item assignment
答案 0 :(得分:1)
这对我有用:
import facebook
token = 'my_token'
graph = facebook.GraphAPI(token)
data = graph.request('/search?q=someusernane&type=user')
print data