简体   繁体   English

FacePy Facebook发布错误

[英]FacePy Facebook post error

I'm trying to integrate Facebook with FacePy and getting the error FacebookError at / No exception supplied . 我正在尝试将Facebook与FacePy集成并FacebookError at / No exception supplied错误FacebookError at / No exception supplied The request is working on the command line through curl, and actually posting on Facebook, so I know permissions and access token are correct. 请求正在通过curl在命令行上工作,并实际在Facebook上发布,所以我知道权限和访问令牌是正确的。 If I remove the graph.post line, there is no error thrown, so I reckon it must be triggered by the actual post attempt. 如果我删除graph.post行,则不会抛出任何错误,因此我认为它必须由实际的帖子尝试触发。 I'm developing locally btw. 我正在开发本地btw。 I have got django-facebook working locally, so that shouldn't be a problem. 我有django-facebook在本地工作,所以这应该不是问题。 What am I doing wrong? 我究竟做错了什么? Thanks 谢谢

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)

Error: 错误:

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

Turned out to be a Facebook permissions error. 原来是Facebook权限错误。 Finding it tricky to get permissions right. 找到正确的权限是很棘手的。 I found this helpful to get an access token with widest permissions: https://developers.facebook.com/tools/explorer 我发现这有助于获得具有最广泛权限的访问令牌: https//developers.facebook.com/tools/explorer

请求方法应该是request.POST而不是GET,因为您要发布到Facebook Graph。

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

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