gpt4 book ai didi

python - facebook 使用 python 获取 friend 的生日

转载 作者:行者123 更新时间:2023-12-02 04:46:10 25 4
gpt4 key购买 nike

我只是想使用它的 python api 在 facebook 上获取我 friend 的生日

我尝试了 https://developers.facebook.com/tools/explorer/ 中的查询使用“me/friends?fields=birthday”,效果很好,但在我的 python 代码中显示“GraphAPIError:必须使用事件访问 token 来查询有关当前用户的信息。”

我在这里发布了我的代码:

import facebook

token = 'a token' # token omitted here, this is the same token when I use in https://developers.facebook.com/tools/explorer/

graph = facebook.GraphAPI(token)
fb = graph.request("me/friends?fields=birthday")
# while graph.request("me/friends") works well


print fb

有人帮忙吗?

最佳答案

实际上,这行得通...

args = {'fields' : 'birthday,name' }
friends = graph.get_object("me/friends",**args)

古怪

关于python - facebook 使用 python 获取 friend 的生日,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19761091/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com