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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.