{% extends "base.html" %} {% load event_tags %} {% block content %} {{ block.super }}
Your current API key is {{ key.key }}
Your current API Authorization Header value is Token {{ key.key }}
Has your key been exposed? Are you ready for a new one?
Alternatively, you can use /api/v2/api-token-auth/ to get your token. Example:
curl -X POST -H 'content-type: application/json' {% if request.is_secure %}https{% else %}http{% endif %}://{{ request.META.HTTP_HOST }}/api/v2/api-token-auth/ -d '{"username": "<YOURUSERNAME>", "password": "<YOURPASSWORD>"}'
To use your API Key you need to specify an Authorization header. Example:
# As a header # Format is ``Authorization: Token <api_key> Authorization: Token {{ key.key }}
Here is a simple python example against the /users endpoint
import requests url = '{% if request.is_secure %}https{% else %}http{% endif %}://{{ request.META.HTTP_HOST }}/api/v2/users/' headers = {'content-type': 'application/json', 'Authorization': 'Token {{ key.key }}'} r = requests.get(url, headers=headers, verify=True) # set verify to False if ssl cert is self-signed for key, value in r.__dict__.iteritems(): print key print value print '------------------'{% endblock %}