django-raise-response
django-raise-response is a simple plugin that provides the ability to return any response by raising it as you would do with django.http.Http404
Why would you need this? If you need to return a non-4XX/5XX response from a class-based view, for example a 303/301 response, this is the only decent way to do it.
Installing
pip install django-raise-response
Then add ‘raiseresponse.middlewares.RaiseResponse’ to your middlewares:
MIDDLEWARE = [
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'raiseresponse.middlewares.RaiseResponse'
]
Usage
Now you can use ResponseError to raise any response:
from raiseresponse import ResponseError # somewhere in your view response_you_want_to_rise = HttpResponse() raise ResponseError(response_you_want_to_rise)
Metadata
Release files for django-raise-response 0.1.0
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-raise-response-0.1.0.tar.gz | 2.0 kB | Without provenance | Details for django-raise-response-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_raise_response-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for django_raise_response-0.1.0-py3-none-any.whl |
Total release size: 6.0 kB
Release files / django-raise-response-0.1.0.tar.gz
| Download URL | django-raise-response-0.1.0.tar.gz |
|---|---|
| Size | 2.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d1baec9c9b3537dd4e185ce4703e3f2f4c679d2d97e95be925ac604197a21c5d
|
|
BLAKE2b-256 checksum How to use checksums |
18af03f49e09f4037a223a96e5d8057b6e6809df3e81dd819568209feae19f6c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / django_raise_response-0.1.0-py3-none-any.whl
| Download URL | django_raise_response-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6b640557bf394b86df9dca386a7018f16f1ef1e6622f588aa548c5006c04af82
|
|
BLAKE2b-256 checksum How to use checksums |
4e139ba06e3bc46a9728436eb34c2033398441533d43955d36735a8700d6bba1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-raise-response 0.1.0
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.