Authenticate Web APIs made with Django REST Framework
- Python (2.7, 3.3, 3.4, 3.5)
- Django (1.8, 1.9, 1.10)
- Django Rest Framework (3+)
Install using pip:
pip install drfapikey
Add 'rest_framework_api_key' to your INSTALLED_APPS
setting:
INSTALLED_APPS = (
...
'rest_framework_api_key',
)
Finally set the django-rest-framework permissions under your django settings:
REST_FRAMEWORK = {
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework_api_key.permissions.HasAPIAccess',
)
}
response = requests.get(
url="http://0.0.0.0:8000/api/login",
headers={
"Api-Key": "fd8b4a98c8f53035aeab410258430e2d86079c93",
},
)
pyvenv env
source env/bin/activate
pip install -r requirements/requirements-testing.txt
python runtests.py
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request
- Make sure tests are passing