[英]Is there a way to access facebook events using graphapi
我有代码来查找事件,但不断收到错误:
文件“facebook_events.py”,第 8 行,在 events = graph.request('/search?q=Poetry&type=event') 文件“/Users/teomeyerhoff/Desktop/projects/jakecongress/facebookenv/lib/python3.7/site -packages/facebook/ init .py",第 313 行,在请求中引发 GraphAPIError(result) facebook.GraphAPIError: (#33) 此 object 不存在或不支持此操作。
Facebook 的 api 发生了一些变化。 看起来我无法再使用查询字符串访问事件: '/search?q=Poetry&type=event'作为图形请求。
import urllib3
import facebook
import requests
token = "EA......" //not actual token
graph = facebook.GraphAPI(access_token=token, version = "2.8")
events = graph.request('/search?q=Poetry&type=event')
print(events)
eventList = events['data']
eventid = eventList[1]['id']
event1 = graph.get_object(id=eventid, fields='attending_count, can_guests_invite, \
category, cover, declined_count, description, \
end_time, guest_list_enabled, interested_count, \
is_canceled, is_page_owned, is_viewer_admin, \
maybe_count, noreply_count, owner, parent_group,\
place, ticket_uri, timezone, type, updated_time')
attenderscount = event1['attending_count']
declinerscount = event1['declined_count']
interestedcount = event1['interested_count']
maybecount = event1['maybe_count']
noreplycount = event1['noreply_count']
attenders = requests.get('https://graph.facebook.com/v2.8/"+eventid+"\
/attending?access_token="+token+"&limit='+str(attenderscount))
attenders_json = attenders.json()
admins = requests.get("https://graph.facebook.com/v2.8/"+eventid+"\
/admins?access_token="+token)
admins_json = admins.json()
感谢您的帮助。
看起来我无法再使用查询字符串访问事件:'/search?q=Poetry&type=event' 作为图形请求。
是的,就是这样。
https://developers.facebook.com/docs/graph-api/changelog/break-changes#search-4-4
搜索 API
您不能再将 /search 端点与以下 object 类型一起使用:
- 事件
- 团体
- 页
- 用户
在随附的博客文章中也提到了https://developers.facebook.com/blog/post/2018/04/04/facebook-api-platform-product-changes/
搜索 API
已弃用:
- 支持使用搜索查找页面、组、事件、用户。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.