Python:Facebook图形API获取用户详细信息

2024-09-26 22:52:52 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图通过Facebook图形API模拟在Facebook中搜索用户。我正在使用facebook-sdk

下面是我的代码。在

import facebook

access_token = "MY_ACCESS_TOKEN"
graph = facebook.GraphAPI(access_token)

def try_query(string):
    query = 'search/?q=' + string + '&type=user'
    data = graph.request(query)
    return len(data['data'])

#My profile
print (" Pratibha Jagnere : ",try_query("Pratibha Jagnere")) 
# some random name
print (" Stephen Foster : ",try_query("Stephen Foster"))

它给了我低于输出的输出。在

^{pr2}$

我不明白为什么它不给我自己的名字的结果。任何帮助都将不胜感激。在


Tags: token图形datastringfacebookaccessquerygraph

热门问题