py-buzz bindings specifically for DRF applications
Project description
drf-buzz
This is an extension of the py-buzz package.
It adds extra functionality especially for DRF. Predominately, it adds the ability to jsonify an exception
Installation
pip install drf-buzz
Usage
Add drf-buzz
exception handler in settings.py
:
REST_FRAMEWORK = {
...
'EXCEPTION_HANDLER': 'drf_buzz.exception_handler'
...
}
Use py-buzz
exceptions in your DRF viewsets:
import drf_buzz
from rest_framework import status, viewsets
class MyException(drf_buzz.DRFBuzz):
status_code = status.BAD_REQUEST
class MyViewSet(viewsets.ViewSet):
def list(self, request):
raise MyException('Not implemented yet.')
Tests
To run the test suite execute the following command in package root folder:
python setup.py test
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
drf-buzz-0.2.1.tar.gz
(3.1 kB
view details)
Built Distribution
File details
Details for the file drf-buzz-0.2.1.tar.gz
.
File metadata
- Download URL: drf-buzz-0.2.1.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f1e19b65a254e0748f2d8c1e821593b7bb07d0a67bd9fa734fb45b947a42dfc4 |
|
MD5 | 5f73a1858e46245c3d6fe538995efdba |
|
BLAKE2b-256 | 7471af3f66b492b0c2a32c7aa5b5686a09fea9f908ecac015da03ad0cec66d05 |
File details
Details for the file drf_buzz-0.2.1-py3-none-any.whl
.
File metadata
- Download URL: drf_buzz-0.2.1-py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52cf0ec38781341feb1236d917454b8fe9016d50fbe82da6bbfa7c6f398b1f28 |
|
MD5 | d5bf90cfd67003f05794811eae72e622 |
|
BLAKE2b-256 | e90159c219f93b21c428e2b1df08f06b60ae9718aeaae1ae30699b48b8c53576 |