Skip to main content

Ready Jsend specified response classes.

Project description

Django Jsend Responses

Jsend specified Responses for APIs.


Overview

Django Jsend Responses supply response classes to use in projects created with Django. See http://labs.omniti.com/labs/jsend for jsend spec.


Requirements

  • Django (1.11, 2.0, 2.1)

Installation

Install using pip...

pip install djangojsendresponses

Using in a code

from jsend_responses import SuccessResponse
from rest_framework.views import APIView


class DriverAPIView(APIView):
    def get(self):
        driver = get_random_driver()
        return SuccessResponse(object=driver)

Response examples

Success response:

{
    "status": "success",
    "data": {
        "object": { 
            "id": 1, 
            "name": "Fist object"
        }
    }
}

Fail response:

{
    "status" : "fail",
    "data" : {
        "name" : "A name is required" 
    }
}

Error response:

{
    "status" : "error",
    "message" : "A service is unavailable to connect"
}

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

djangojsendresponses-0.1.1.tar.gz (2.1 kB view details)

Uploaded Source

Built Distribution

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

djangojsendresponses-0.1.1-py3-none-any.whl (2.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: djangojsendresponses-0.1.1.tar.gz
  • Upload date:
  • Size: 2.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.2

File hashes

Hashes for djangojsendresponses-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e7d73f4afe8d397dab814ec9c552b2cd8751a069fbaf7bea15bf3d7a566c9be1
MD5 8c5cef43cf5d23fcd82d7c622930b93f
BLAKE2b-256 afe222e53fc9d8802463dbd060564f3ad72e114eca7391b432478d46fc4c58f5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: djangojsendresponses-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 2.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.2

File hashes

Hashes for djangojsendresponses-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9e91f27695da1d5d880db2426f5a3d60f6de9d59adabd28f2975d499b27dc4d3
MD5 66db86ff52cb1cc1d28f19b5a8e576f3
BLAKE2b-256 9ac75917861fc2d0dff550cefdb359840cc5fd82624129f693d3250246ea579c

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