Drop duplicated requests
Project description
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
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
Built Distribution
File details
Details for the file django-duprequests-0.1.5.tar.gz
.
File metadata
- Download URL: django-duprequests-0.1.5.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97adf5e94a1af291abf57fcf2d8258702356ca68cda6b2c2830d7127925ea373 |
|
MD5 | 3bbfa05aefefd749cb2478583ffa7f0c |
|
BLAKE2b-256 | 53daa536772fe4ea4b3dd76c27ac247cb2e42891f9446d3df5fc79f31dae3cc6 |
File details
Details for the file django_duprequests-0.1.5-py3-none-any.whl
.
File metadata
- Download URL: django_duprequests-0.1.5-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33b0526d200bffa147576ef96339d34b0489571d5a91a2ea4dd7a398d22f9795 |
|
MD5 | 4944e2fbd12a84790c42deec6db07e15 |
|
BLAKE2b-256 | b0b4db629ae7558aa38bbe3aa929d7f7e91dfd75246404f7f3c48ea2f794b553 |