Skip to content

This is an extension of the py-buzz package to jsonify an exception in a DRF application.

License

Notifications You must be signed in to change notification settings

adalekin/drf-buzz

Repository files navigation

Build Status Coverage Status

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

About

This is an extension of the py-buzz package to jsonify an exception in a DRF application.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages