[英]Using Marketing API to get post data
i am trying to get the post data by using FB's Marketing API, but the error comes up:我正在尝试使用 FB 的营销 API 获取帖子数据,但出现错误:
KeyError: 'posts' KeyError:'帖子'
which is the 'posts'in line 6.这是第 6 行的“帖子”。
Below is my code, and i hided my id with xxx,下面是我的代码,我用xxx隐藏了我的id,
page_id = "id=xxx"
recent_2_posts = graph.get_object(id=xxx,
field='posts.fields(type, name, created_time, object_id).limit(2)')
post_1 = recent_2_posts['posts']['data'][0]
post_2 = recent_2_posts['posts']['data'][1]
print(post_1)
print(post_2)
Would anyone please assist.有没有人请帮忙。 Thank you.谢谢你。
Check whether you getting data in "recent_2_posts"
.检查您是否在"recent_2_posts"
获取数据。 It must be blank or it will not have key name posts
它必须为空,否则将没有关键名称posts
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.