class QueueResource(ModelResource):
class Meta:
queryset = Queue.objects.all()
resource_name = 'queue'
authentication = ApiKeyAuthentication()
authorization = DjangoAuthorization()
allowed_methods = ['get','patch','put','post']
def prepend_urls(self):
return [url(r"^(?P<resource_name>%s)/fail%s$" % (self._meta.resource_name, trailing_slash()), self.wrap_view('fail'), name="bot_api_fail"),]
def fail(self, request, **kwargs):
queueId = request.POST('qid')
errorMessage = request.POST('msg')
------------------------------------------------------------------------
my curl command:
------------------------------------------------------------------------
curl --dump-header - -H "Authorization ApiKey USER:KEY" -H "Content-Type: application/json" -X POST --data '{"qid": "4", "msg": "An error occured!"}'
http://IP/api/fail/------------------------------------------------------------------------
the corresponding error message:
------------------------------------------------------------------------
HTTP/1.0 401 UNAUTHORIZED
Date: Wed, 13 Feb 2013 19:16:00 GMT
Server: WSGIServer/0.1 Python/2.7.3
X-Frame-Options: SAMEORIGIN
Content-Type: text/html; charset=utf-8
------------------------------------------------------------------------
Does anyone of you has an idea why I'm getting this error code?