Skip to main content

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

django_hawk_drf-1.1.5.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_hawk_drf-1.1.5-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file django_hawk_drf-1.1.5.tar.gz.

File metadata

  • Download URL: django_hawk_drf-1.1.5.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Darwin/24.5.0

File hashes

Hashes for django_hawk_drf-1.1.5.tar.gz
Algorithm Hash digest
SHA256 e877cdbf19e92403d58cdcf05ae250cd984c5d7926902ba84b5568fdee80594b
MD5 72fbd03002c025a641731b11710b4c1a
BLAKE2b-256 56ebcdab1b8665c50c6a3347374e9c40be550bb82531d95a57cbb99225adf1ec

See more details on using hashes here.

File details

Details for the file django_hawk_drf-1.1.5-py3-none-any.whl.

File metadata

  • Download URL: django_hawk_drf-1.1.5-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Darwin/24.5.0

File hashes

Hashes for django_hawk_drf-1.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 418bb73177e6576503ab1ad59670bf3744639278b89fd9d9b32a404fb6524ed1
MD5 8631a5306098a0825089fc85a8aa976c
BLAKE2b-256 22920a85091ce0ff8e8169fe0e8d802262b265c0e0c08dac2799176114ce5d45

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page