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
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 Distribution
Built Distribution
Close
Hashes for djangojsendresponses-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e7d73f4afe8d397dab814ec9c552b2cd8751a069fbaf7bea15bf3d7a566c9be1 |
|
MD5 | 8c5cef43cf5d23fcd82d7c622930b93f |
|
BLAKE2b-256 | afe222e53fc9d8802463dbd060564f3ad72e114eca7391b432478d46fc4c58f5 |
Close
Hashes for djangojsendresponses-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e91f27695da1d5d880db2426f5a3d60f6de9d59adabd28f2975d499b27dc4d3 |
|
MD5 | 66db86ff52cb1cc1d28f19b5a8e576f3 |
|
BLAKE2b-256 | 9ac75917861fc2d0dff550cefdb359840cc5fd82624129f693d3250246ea579c |