gpt4 book ai didi

python - FacePy Facebook 帖子错误

转载 作者:行者123 更新时间:2023-11-30 23:40:37 25 4
gpt4 key购买 nike

我正在尝试将 Facebook 与 FacePy 集成,但收到错误 FacebookError at/No exceptionprovided。该请求通过curl 在命令行上运行,并实际发布在Facebook 上,因此我知道权限和访问 token 是正确的。如果我删除 graph.post 行,则不会抛出任何错误,因此我认为它一定是由实际的发布尝试触发的。顺便说一句,我正在本地开发。我已经让 django-facebook 在本地工作,所以这应该不是问题。我究竟做错了什么?谢谢

from facepy import GraphAPI

@login_required
def index(request):
proposed_event_list = Event.objects.all().filter(date__gt=datetime.now()).annotate(c=Count('userprofile')).filter(c__lt=4).order_by('date')
confirmed_event_list = Event.objects.all().filter(date__gt=datetime.now()).annotate(c=Count('userprofile')).filter(c__gt=3).order_by('date')
past_event_list = Event.objects.all().filter(date__lt=datetime.now()).order_by('date')

graph = GraphAPI("AAAD392hkaGX0BAP0U1IZClcPh6qZCpIZBqiP5ze3ELZB14ZChropfyWT6OeELgfgYiY929Adi90kgLGXdLQ3qOQM0KsjvQ6S9Q4VbuHXwhAZD")
graph.post(path="https://graph.facebook.com/426364711649/feed", retry=1, message="Hello")

context = RequestContext(request)
context['proposed_event_list'] = proposed_event_list
context['confirmed_event_list'] = confirmed_event_list
context['past_event_list'] = past_event_list
return render_to_response('crewcal.html', context)

错误:

FacebookError at /
No exception supplied
Request Method: GET
Request URL: http://localhost:8000/
Django Version: 1.4.1
Exception Type: FacebookError
Exception Location: /usr/local/lib/python2.7/dist-packages/facepy/graph_api.py in post, line 69
Python Executable: /usr/bin/python
Python Version: 2.7.3
Python Path:
['/usr/local/lib/python2.7/dist-packages/requests/packages',
...
'/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode']
Server time: Fri, 21 Sep 2012 18:49:11 -0500

最佳答案

结果是 Facebook 权限错误。发现获得正确的权限很棘手。我发现这有助于获取具有最广泛权限的访问 token :https://developers.facebook.com/tools/explorer

关于python - FacePy Facebook 帖子错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12539603/

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