How to make post request in Django TastyPie using ApiKeyAuthentication
<p>I have resource like this:</p>

<pre><code>class EntryResource(ModelResource):
    class Meta:
        queryset = Entry.objects.all()
        resource_name = 'entry'
        allowed_methods = ['post']
        authentication = ApiKeyAuthentication()
        authorization = Authorization()
</code></pre>

<p>And try to make request to this resource according to <a href="http://django-tastypie.readthedocs.io/en/latest/authentication.html#apikeyauthentication" rel="nofollow">documentation</a>:</p>

<pre><code>requests.post('http://localhost/api/entry/',
              json={"key1": "value1",
                    "key2": "value2"},
              headers={"content-type": "application/json",
                       "Authorization": "ApiKey",
                       "&lt;username&gt;": "&lt;api_key&gt;"})
</code></pre>

<p>But get 401.</p>

<p>from documentation:</p>

<blockquote>
  <p>Authorization: ApiKey daniel:204db7bcfafb2deb7506b89eb3b9b715b09905c8</p>
</blockquote>

<p>your request must be like this:</p>

<pre><code>requests.post('http://localhost/api/entry/',
              json={"key1": "value1",
                    "key2": "value2"},
              headers={"content-type": "application/json",
                       "Authorization": "ApiKey &lt;username&gt;:&lt;api_key&gt;"})
</code></pre>

python django tastypie