seteuid0's blog
Themed by Diary.
django中使用xmlrpc报403问题解决办法

Django’s CSRF protection is turned on by default now, and is quite effective at blocking cross site requests, including RPC requests like this.Symptoms:Valid XMLRPC requests to the xmlrpc endpoint are greeted with a 403 Forbidden response. This is generated by the CSRF middleware because a CSRF token isn’t being included in the POST.Resolution:Turn of CSRF for the handle_xmlrpc method.In django_xmlrpc/views.py, add the csrf_exempt decorator to the handle_xmlrpc method:from django.views.decorators.csrf import csrf_exempt…@csrf_exemptdef handle_xmlrpc(request):    ….