【发布时间】:2016-10-12 13:44:35
【问题描述】:
我有这样的资源:
class EntryResource(ModelResource):
class Meta:
queryset = Entry.objects.all()
resource_name = 'entry'
allowed_methods = ['post']
authentication = ApiKeyAuthentication()
authorization = Authorization()
并尝试根据documentation向该资源发出请求:
requests.post('http://localhost/api/entry/',
json={"key1": "value1",
"key2": "value2"},
headers={"content-type": "application/json",
"Authorization": "ApiKey",
"<username>": "<api_key>"})
但是得到 401。
【问题讨论】: