Skip to main content

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!

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

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

django-duprequests-0.1.2.tar.gz (3.6 kB view details)

Uploaded Source

File details

Details for the file django-duprequests-0.1.2.tar.gz.

File metadata

File hashes

Hashes for django-duprequests-0.1.2.tar.gz
Algorithm Hash digest
SHA256 93e15b0b7eb765bcb6d287e2676e1bcdd2b9c584fd7a23488f07537568ef381f
MD5 4ff4ed070a11362d88291ce97f172e8b
BLAKE2b-256 66cb99e58b466cf8310886f37cfaa811df8148f24b890b9f6a4c6ad35c0caf2d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page