Django Error Response In Json
django_json_error_response is ready to use library for django to show response in customized JsonResponse.
New Features!
- Easy to use response than generic JsonResopnse.
- Support django-3+ version (Self Tested)
You can also:
- Contribute (https://github.com/subodh358/django_status_response)
Use:
from django_json_error_response.http import (
Http400Response,
Http403Response,
Http404Response,
Http500Response,
SuccessResponse,
ErrorResponse
)
#code lines
def my_view(request):
if my_condition :
#your code
return SuccessResponse(message=my_message) #default status is 200 for this response
else:
return ErrorResponse(message=my_message, status=status_code) #status_code can be anything that you want to respond with.
def my_custom_view(request):
if condition:
#your code
return SuccessResponse(message=my_message)
else:
Http404Response(message=my_message)
For ErrorResponse()
ErrorResponse take two arguments ~ message ~ status (for error except 404,403,400,500)
Exra information
You can also pass json data insted of message or both at same time in every Resonse.
License
MIT
Free Software, Hell Yeah!
Metadata
Release files for django-json-error-response 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django_json_error_response-0.1.tar.gz | 2.5 kB | Without provenance | Details for django_json_error_response-0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_json_error_response-0.1-py3-none-any.whl | Python 3 | none | any | Details for django_json_error_response-0.1-py3-none-any.whl |
Total release size: 6.2 kB
Release files / django_json_error_response-0.1.tar.gz
| Download URL | django_json_error_response-0.1.tar.gz |
|---|---|
| Size | 2.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c2d13b6216145cb4e767123b4b76bdc290db40ae4d9a9c386eda63e93196be96
|
|
BLAKE2b-256 checksum How to use checksums |
d2ec1a9ae7afdcacdf1a6f13f4ae9edf5171c031f8a484ee3b109542da35481a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.2
|
Release files / django_json_error_response-0.1-py3-none-any.whl
| Download URL | django_json_error_response-0.1-py3-none-any.whl |
|---|---|
| Size | 3.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9bb977be4db7f37b993844e20bf0ca75cb9ee392cbd77930b4fe752c31fc7b3a
|
|
BLAKE2b-256 checksum How to use checksums |
cd8026c458012a5378d10f554ba78fcfe50c6d1e892f35b8b63e35950d6c7d1f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.2
|
Security for django-json-error-response 0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.