django-hawk-drf


Namedjango-hawk-drf JSON
Version 1.1.4 PyPI version JSON
download
home_pagehttps://github.com/uktrade/django-hawk-drf/
SummaryAuthenticate Django Rest Framework Views with django-hawk
upload_time2025-01-06 11:17:38
maintainerNone
docs_urlNone
authorCameron Lamb
requires_python<4.0,>=3.8
licenseMIT
keywords django
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Django Hawk DRF

This package provides [Django Rest Framework](https://github.com/encode/django-rest-framework/) helper classes for use with [Django Hawk](https://github.com/uktrade/django-hawk).

## Installation

Read the [Django Hawk installation](https://github.com/uktrade/django-hawk#installation) documentation.

## Example usage

Read the [Django Hawk example usage](https://github.com/uktrade/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.

```python
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](https://pypi.org/project/tox/) to test compatibility across different Django versions.

To run these tests with tox, just run the following:

```
make tox
```

## Pushing to PyPI

- [PyPI Package](https://pypi.org/project/django-hawk-drf/)
- [Test PyPI Package](https://test.pypi.org/project/django-hawk-drf/)

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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/uktrade/django-hawk-drf/",
    "name": "django-hawk-drf",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": null,
    "keywords": "django",
    "author": "Cameron Lamb",
    "author_email": "live.services@digital.trade.gov.uk",
    "download_url": "https://files.pythonhosted.org/packages/03/fa/a93343f0426532cd40cf7c4892c2b78427e4dc2e619797ef8038451c8da8/django_hawk_drf-1.1.4.tar.gz",
    "platform": null,
    "description": "# Django Hawk DRF\n\nThis package provides [Django Rest Framework](https://github.com/encode/django-rest-framework/) helper classes for use with [Django Hawk](https://github.com/uktrade/django-hawk).\n\n## Installation\n\nRead the [Django Hawk installation](https://github.com/uktrade/django-hawk#installation) documentation.\n\n## Example usage\n\nRead the [Django Hawk example usage](https://github.com/uktrade/django-hawk#example-usage) documentation.\n\nAdd the `HawkResponseMiddleware` to the `MIDDLEWARE` setting in your project like so:\n\n```\nMIDDLEWARE = [\n    ...\n    \"django_hawk.middleware.HawkResponseMiddleware\",\n    \"django_hawk_drf.middleware.HawkResponseMiddleware\",\n    ...\n]\n```\n\nTo check the you can use the `django_hawk.authentication.HawkAuthentication` authentication class.\n\n```python\nfrom rest_framework.response import Response\nfrom rest_framework.viewsets import ViewSet\n\nfrom django_hawk_drf.authentication import HawkAuthentication\n\n\nclass ExampleViewSet(ViewSet):\n    authentication_classes = (HawkAuthentication,)\n    permission_classes = ()\n\n    def list(self, request):\n        return Response([])\n```\n\n## Testing\n\nTests belong in the `/django_hawk_drf/tests/` directory. You can run the tests by installing the requirements like so:\n\n\n```\nmake setup\n```\n\nNow you can run the tests using the following command:\n\n```\npoetry run python manage.py test\n```\n\n### Tox tests\n\nWe use [tox](https://pypi.org/project/tox/) to test compatibility across different Django versions.\n\nTo run these tests with tox, just run the following:\n\n```\nmake tox\n```\n\n## Pushing to PyPI\n\n- [PyPI Package](https://pypi.org/project/django-hawk-drf/)\n- [Test PyPI Package](https://test.pypi.org/project/django-hawk-drf/)\n\nRunning `make build-package` will build the package into the `dist/` directory\nRunning `make push-pypi-test` will push the built package to Test PyPI\nRunning `make push-pypi` will push the built package to PyPI\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Authenticate Django Rest Framework Views with django-hawk",
    "version": "1.1.4",
    "project_urls": {
        "Homepage": "https://github.com/uktrade/django-hawk-drf/"
    },
    "split_keywords": [
        "django"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "115ffa5af435b3f85134f639ff8b6be8d6280b5f0a3124c23626013ecd7f53bb",
                "md5": "22100fec08f09aa7eec24d1661f27577",
                "sha256": "cd9bba1d55d2bca7be2d9ae04a1a7ee04fe6c7486c82bb7904f2ac63e94ac24a"
            },
            "downloads": -1,
            "filename": "django_hawk_drf-1.1.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "22100fec08f09aa7eec24d1661f27577",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 7741,
            "upload_time": "2025-01-06T11:17:36",
            "upload_time_iso_8601": "2025-01-06T11:17:36.630623Z",
            "url": "https://files.pythonhosted.org/packages/11/5f/fa5af435b3f85134f639ff8b6be8d6280b5f0a3124c23626013ecd7f53bb/django_hawk_drf-1.1.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "03faa93343f0426532cd40cf7c4892c2b78427e4dc2e619797ef8038451c8da8",
                "md5": "344a572ba82ef2703c4436bd2bbc57d9",
                "sha256": "30444352fedfb310ac0a34f5216e668dd09956bde8efeea2d9efd541cbe0f3d3"
            },
            "downloads": -1,
            "filename": "django_hawk_drf-1.1.4.tar.gz",
            "has_sig": false,
            "md5_digest": "344a572ba82ef2703c4436bd2bbc57d9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 5626,
            "upload_time": "2025-01-06T11:17:38",
            "upload_time_iso_8601": "2025-01-06T11:17:38.809810Z",
            "url": "https://files.pythonhosted.org/packages/03/fa/a93343f0426532cd40cf7c4892c2b78427e4dc2e619797ef8038451c8da8/django_hawk_drf-1.1.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-06 11:17:38",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "uktrade",
    "github_project": "django-hawk-drf",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "django-hawk-drf"
}
        
Elapsed time: 1.74653s