Skip to main content

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!

Authors

  • Sergio Oliveira - Initial work - Seocam

  • Danilo Martins - Packaging and distribution - Mawkee

License

This project is licensed under the BSD License - see the LICENSE file for details

Acknowledgments

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)

Source distribution for django-duprequests 0.1.5
File Size Uploaded
django-duprequests-0.1.5.tar.gz 4.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-duprequests 0.1.5
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

0.1.4

2 release files

0.1.3

1 release file

0.1.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page