您无权在 Python 前夕访问所请求的资源

You don't have the permission to access the requested resource in Python Eve

当使用 DELETE (http://localhost:5000/tax/559c0180b9f1f1072f240065) 访问 REST 端点时,我收到一个错误。错误如下。 Tax 是我要删除的集合,URL 中的以下值是我要删除的文档的 ID。 Status 403 FORBIDDEN Show explanation Loading time: 7 Request headers Accept: application/json Origin: chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo CSP: active User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36 Content-Type: application/x-www-form-urlencoded Accept-Encoding: gzip, deflate, sdch Accept-Language: en-US,en;q=0.8 Response headers Content-Type: application/json Content-Length: 180 Server: Eve/0.6-dev0 Werkzeug/0.10.4 Python/2.7.6 Date: Tue, 07 Jul 2015 16:46:40 GMT

{ _status: "ERR" _error: { message: "You don't have the permission to access the requested resource. It is either read-protected or not readable by the server." code: 403 }- } 我使用的负载是 {"KONG": "Donkey"}

我该怎么做才能解决这个问题?

我使用的代码在以下链接

https://gist.github.com/anonymous/fda6080f3e7910d4be84 https://gist.github.com/anonymous/3bab73901f901087177b

您还需要随请求一起提供 If-Match header(连同文件 ETag)。参见 Data Integrity and Concurrency Control。默认情况下,所有编辑操作都需要 Etag,但您可以 opt-out 只需将 IF-MATCH 设置为 False:

If your use case requires, you can opt to completely disable concurrency control. ETag match checks can be disabled by setting the IF_MATCH configuration variable to False (see Global Configuration). When concurrency control is disabled no etag is provided with responses. You should be careful about disabling this feature, as you would effectively open your API to the risk of older versions replacing your documents.