Middleware for dropping duplicated requests
Getting Started
Just install, register the middleware and enjoy. You can adjust the timeout for duplicated requests on your settings.py file.
Prerequisites
You need Django >= 1.9 for this to work. It may work on previous versions, but I haven’t tested it. I also tested with Django 2.0, but it may still break before it’s released.
Installing
pip install django-duprequests
Add the middleware to your MIDDLEWARE or MIDDLEWARE_CLASSES (depending on your Django version)
MIDDLEWARE_CLASSES = [
(...)
'duprequests.middleware.DropDuplicatedRequests',
(...)
]
Customizing
Also on settings.py you can set up a few variables:
DUPLICATED_REQUESTS_CACHE_NAME - the name of the cache (default value is default) DUPLICATED_REQUESTS_CACHE_TIMEOUT - cache timeout (default value is 5; in seconds) DUPLICATED_REQUESTS_COOKIE_NAME - name of the cookie set on the user’s session (default value is dj-request-id) DUPLICATED_REQUESTS_COOKIE_PREFIX - cookie prefix, combined with a random UUID to set the response cookie (default value is request-id-)
Running the tests
The test suite runs outside of a django app (it simulates a very simple one). Just run tests.py and you’re golden.
Contributing
Feel free to contribute to this project! Documentation is close to non-existant. Bug reports and enhancement requests can be submitted on https://github.com/CraveFood/django-duprequests/issues – Pull Requests are also welcome!
License
This project is licensed under the BSD License - see the LICENSE file for details
Acknowledgments
The simple test suite was copied from project Django CORS Middleware by @zestedesavoir – https://github.com/zestedesavoir/django-cors-middleware
Release files for django-duprequests 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-duprequests-0.1.5.tar.gz | 4.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_duprequests-0.1.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.6 kB
Release files / django-duprequests-0.1.5.tar.gz
| Download URL | django-duprequests-0.1.5.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
97adf5e94a1af291abf57fcf2d8258702356ca68cda6b2c2830d7127925ea373
|
|
BLAKE2b-256 checksum How to use checksums |
53daa536772fe4ea4b3dd76c27ac247cb2e42891f9446d3df5fc79f31dae3cc6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.4
|
Release files / django_duprequests-0.1.5-py3-none-any.whl
| Download URL | django_duprequests-0.1.5-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
33b0526d200bffa147576ef96339d34b0489571d5a91a2ea4dd7a398d22f9795
|
|
BLAKE2b-256 checksum How to use checksums |
b0b4db629ae7558aa38bbe3aa929d7f7e91dfd75246404f7f3c48ea2f794b553
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.4
|