Skip to main content

Access timer middlware is a middleware which allow to control access to some paths, like/api/, /admin/ and what you want!

Project description

django-access-timer-middleware

Access timer middlware is a middleware which allow to control access to some paths, like /api/, /admin/ and what you want!

How to install the package

To install the package, run:

pip install django-access-timer-middleware

In settings.py write next stuff:

INSTALLED_APPS:

INSTALLED_APPS = [
    ...,
    'access_timer_middleware',
    ...,
]

MIDDLEWARE:

MIDDLEWARE = [
    ...,
    'access_timer_middleware.middleware.AccessTimerMiddleware',
]

And then:

python manage.py makemigrations
python manage.py migrate

How to use?

The default access time to endpoints is 1 hour. That value you can change in admin panel. Available the next values:

  • 1 hour
  • 3 hours
  • 6 hours
  • 1 day
  • 2 weeks

Next, in settings you should to set a one of two constants:

RESTRICTED_PATHS = ['/api/']

The paths are participating in checking access

or...

EXCLUDED_PATHS = ['/api/stuff/login/', '/api/stuff/signup/', '/admin/']

...paths, which are excluded from it, but rest of the endpoints there are in checking.

Using those two constants at the same time will throw an exception.

Version

Current version: 1.0

Updates

This package won't have updates, except of bug updates.

Author

pavelbeard

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_access_timer_middleware-1.0.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_access_timer_middleware-1.0-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file django_access_timer_middleware-1.0.tar.gz.

File metadata

File hashes

Hashes for django_access_timer_middleware-1.0.tar.gz
Algorithm Hash digest
SHA256 4dc53142b6efb098ed5566652d34e389911fdca77cb873eaf167f427295e8e27
MD5 7bd7bc0e9d24849ae0579447a18fe38b
BLAKE2b-256 29789677d6caa8ef20975d92e921ee9ae26a681c131edae243cd011f9a18bddd

See more details on using hashes here.

File details

Details for the file django_access_timer_middleware-1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_access_timer_middleware-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ce28948ed5015304c499f879e43311ceee415105d7e8d9bacb922980fdf96a2d
MD5 7391b75b7c5df4686ae9e63a131214b5
BLAKE2b-256 b09eedd375c34be1f35981961b90cebeeaf44fc7f92a3158047225d5ecc21778

See more details on using hashes here.

Supported by

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