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.1.tar.gz (8.9 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.1-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for drf_standardized_responses-0.1.1.tar.gz
Algorithm Hash digest
SHA256 26b69e1881b3a8cf77532cbd4a8dbe0713673e15ec5b034470771441353de4af
MD5 b2774410ccac46b14dee01ae28e9a722
BLAKE2b-256 c6811889cf301c23d4c48b536d395b0d0cbf375e1e55793d787ed21e5fef71af

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for drf_standardized_responses-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 68221e0f5bc134076aa7c4fe01e7b5ef44ebd71b209c79a8d3bd9f52f42e8bd5
MD5 92548ea350bf9f4319b1d9de78db030b
BLAKE2b-256 2d72f41abf598dd91991d2a4386b8ddf19c690443e7386a1590f6058eae284db

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