繁体   English   中英

facebook使用python获取朋友的生日

[英]facebook get friends' birthdays using python

我只想用facebook的python api在facebook上结交朋友的生日

我尝试使用“me / friends?fields = birthday”在https://developers.facebook.com/tools/explorer/中查询,这很好,但在我的python代码中它说“GraphAPIError:一个活动的访问令牌必须是用于查询有关当前用户的信息。“

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

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)

诡诈地

我调整了一点,这部分工作。

from facepy import GraphAPI
graph=GraphAPI('AccessToken')
friends=[]
friends= graph.get("me/friends?fields=birthday") 
print friends

但是,它只返回一些生日(仅有600多名朋友中的3人返回)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM