Authenticate Django Rest Framework Views with django-hawk
Project description
Django Hawk DRF
This package provides Django Rest Framework helper classes for use with Django Hawk.
Installation
Read the Django Hawk installation documentation.
Example usage
Read the Django Hawk example usage documentation.
Add the HawkResponseMiddleware
to the MIDDLEWARE
setting in your project like so:
MIDDLEWARE = [
...
"django_hawk.middleware.HawkResponseMiddleware",
"django_hawk_drf.middleware.HawkResponseMiddleware",
...
]
To check the you can use the django_hawk.authentication.HawkAuthentication
authentication class.
from rest_framework.response import Response
from rest_framework.viewsets import ViewSet
from django_hawk_drf.authentication import HawkAuthentication
class ExampleViewSet(ViewSet):
authentication_classes = (HawkAuthentication,)
permission_classes = ()
def list(self, request):
return Response([])
Testing
Tests belong in the /django_hawk_drf/tests/
directory. You can run the tests by installing the requirements like so:
make setup
Now you can run the tests using the following command:
poetry run python manage.py test
Tox tests
We use tox to test compatibility across different Django versions.
To run these tests with tox, just run the following:
make tox
Pushing to PyPI
Running make build-package
will build the package into the dist/
directory
Running make push-pypi-test
will push the built package to Test PyPI
Running make push-pypi
will push the built package to PyPI
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file django_hawk_drf-1.1.2.tar.gz
.
File metadata
- Download URL: django_hawk_drf-1.1.2.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.11.6 Darwin/23.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ad594e0618700d45df1d228d5f837cf1d1f01368050b331dc66c7c249f56187 |
|
MD5 | 5286f8ca0ed2d246b4b309a70d68c4b4 |
|
BLAKE2b-256 | e241db5e3fa20d1715b76ab5ed61f08ff5f427a12373baa593eb03a3537a2de7 |
File details
Details for the file django_hawk_drf-1.1.2-py3-none-any.whl
.
File metadata
- Download URL: django_hawk_drf-1.1.2-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.11.6 Darwin/23.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3c75e434d3c1f31c87caca333cd020ceb10716a776add0801e5debce1102fe6 |
|
MD5 | f893c56b18b986e4b3e054d9d933dda3 |
|
BLAKE2b-256 | b3cf260af99c8d262d81abf9c1ef9334917050c8f3388d8a7bb0b538443c122f |