get_Object()在Fabook SDK中实际作为参数的是什么?

2024-06-26 14:46:57 发布

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

我想在get_object()中以用户的身份发送朋友的名字,在下面的代码中获取他的公开帖子。但我犯了个错误

raise GraphAPIError(result) facebook.GraphAPIError: (#803) Cannot query users by their username (tayyab.rasheed.545)

user = 'tayyab.rasheed.545' #is giving error
#user = 'BillGates'         #is working fine.
# user = 'me'               #is working fine.

graph = facebook.GraphAPI(access_token)
profile = graph.get_object(user)
posts = graph.get_connections(profile['id'], 'posts')

为什么会出错?我想我做错了什么。BillGatesme运行良好,那么为什么不tayyab.rasheed.545朋友的简介是https://www.facebook.com/tayyab.rasheed.545


Tags: getfacebookobjectis朋友profileworkinggraph
2条回答

不可能获得任何用户的公开帖子。即使你拥有公开的职位,你也需要获得user_posts的授权。你知道吗

编辑:请不要改变你的问题,特别是当已经有答案的时候。我的回答是正确的。你不应该得到任何数据的用户谁没有授权你的应用程序无论如何。你知道吗

Why is the error?

因为Facebook用v2.0从API中删除了username字段,并且正如错误消息所说的那样,您不能再通过用户名查询用户配置文件了。你知道吗

BillGates and me is working fine then why not `tayyab.rasheed.545

BillGates只是一个Facebook页面,而不是一个用户档案。你知道吗

(而且me首先与用户名无关。)

相关问题 更多 >