Skip to main content

A simple Django app to standardize responses for DRF projects.

Project description

drf-standardized-responses

PyPI Downloads Python Version License

Standardized responses for Django REST Framework projects.

Features

  • Consistent Response Format: All API responses follow a standardized structure.
  • Custom Renderers: JSON renderer that formats all responses with consistent structure.
  • Pagination: Standardized pagination with consistent output format.
  • Response Utilities: Helper functions for creating standard success and error responses.

Installation

pip install drf-standardized-responses

Quick Start

Add the necessary components to your Django REST Framework settings:

REST_FRAMEWORK = {
    # Exception handling for consistent error responses
    'EXCEPTION_HANDLER': 'drf_standardized_responses.exceptions.standardized_exception_handler',
    
    # Pagination with standardized format
    'DEFAULT_PAGINATION_CLASS': 'drf_standardized_responses.pagination.StandardizedPageNumberPagination',
    
    # Response rendering for consistent output structure
    'DEFAULT_RENDERER_CLASSES': [
        'drf_standardized_responses.renderers.StandardizedJSONRenderer',
        'rest_framework.renderers.BrowsableAPIRenderer',
    ],
}

Documentation

For more detailed documentation, see the docs directory.

License

BSD License

Copyright (c) 2025, All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

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

drf_standardized_responses-0.1.2.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

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

drf_standardized_responses-0.1.2-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file drf_standardized_responses-0.1.2.tar.gz.

File metadata

File hashes

Hashes for drf_standardized_responses-0.1.2.tar.gz
Algorithm Hash digest
SHA256 c2771a0a8d57e8dfddd32543339ad1690933359301977d4621bfafbb9ec64a21
MD5 72a19dd3f743c3b7be7d463baf27b617
BLAKE2b-256 033891ce9e41872bfa3b7b653b9595c08c6b5f0d100025b1b95f29a01d259bf9

See more details on using hashes here.

File details

Details for the file drf_standardized_responses-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for drf_standardized_responses-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7e5e53fb190ac8148253b1ba66f9e8737eb058249662099263b5cca361ce79d0
MD5 c5bd826c76222d1d2ada023bbabba52c
BLAKE2b-256 588b67413c4c00e5dbadcc739fbc59db8c31dbbc611a55063573105e73b12a05

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