All Projects → iam-mhaseeb → Djano-Anti-Crawler

iam-mhaseeb / Djano-Anti-Crawler

Licence: MIT License
A light weight anti crawler app for Django.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Djano-Anti-Crawler

django-proxypay
Django Proxypay is a Django Framework application/library that facilitates the integration of your Django project with the Proxypay API.
Stars: ✭ 14 (-6.67%)
Mutual labels:  django-application, django-library
sorl-thumbnail-async
Asynchronous thumbnailing app in django with remote storages like S3
Stars: ✭ 21 (+40%)
Mutual labels:  django-application
django-survey
A django survey app that can export results as CSV or PDF using your native language.
Stars: ✭ 178 (+1086.67%)
Mutual labels:  django-application
python-web-dev-21-2
Material for "Web Development in Python with Django" using Django 2.1, published as a Pearson LiveLesson on Safari Books Online
Stars: ✭ 38 (+153.33%)
Mutual labels:  django-application
Django-Verify-Email
A two-step verification for new accounts by verifying email.
Stars: ✭ 51 (+240%)
Mutual labels:  django-application
django-renderpdf
📄 A Django app to render django templates as PDF files.
Stars: ✭ 37 (+146.67%)
Mutual labels:  django-application
Deep-learning-model-deploy-with-django
Serving a keras model (neural networks) in a website with the python Django-REST framework.
Stars: ✭ 76 (+406.67%)
Mutual labels:  django-application
django-qa
A simple Q&A App
Stars: ✭ 97 (+546.67%)
Mutual labels:  django-application
PyQuotes
PyQuotes is a Django-based web application and REST API. That will allow you to launch an online quotes service.
Stars: ✭ 23 (+53.33%)
Mutual labels:  django-application
acme2certifier
library implementing ACME server functionality
Stars: ✭ 62 (+313.33%)
Mutual labels:  django-application
django-siteforms
Django reusable app to simplify form construction
Stars: ✭ 15 (+0%)
Mutual labels:  django-application
mubapp
MUB is a multi-user blog web app using the Python-Django infrastructure.
Stars: ✭ 24 (+60%)
Mutual labels:  django-application
django-extra-field-validation
Extends the Django model with required, conditional, and optional field validation.
Stars: ✭ 18 (+20%)
Mutual labels:  django-application
PyShop
PyShop is an online Python Ecommerce website built with Django, SQLite and Bootstrap. A simple and lightweight ecommerce app easily deployable anywhere anytime with modules developed upon the inbuilt django admin.
Stars: ✭ 17 (+13.33%)
Mutual labels:  django-application
NearBeach
NearBeach is an open sourced project management tool, helping you keep track of your project. You can track requirements, projects and tasks
Stars: ✭ 97 (+546.67%)
Mutual labels:  django-application
DjanGoat
Python and Django implementation of the OWASP RailsGoat project
Stars: ✭ 65 (+333.33%)
Mutual labels:  django-application
wagtailmath
Beautiful equations in your StreamField content
Stars: ✭ 27 (+80%)
Mutual labels:  django-application
django-lock-tokens
A Django application that provides a locking mechanism to prevent concurrency editing.
Stars: ✭ 19 (+26.67%)
Mutual labels:  django-application
django-pyas2
AS2 file transfer Server built on Python and Django.
Stars: ✭ 47 (+213.33%)
Mutual labels:  django-application
django-rest-email-auth
Django app to handle authentication and registration by email.
Stars: ✭ 13 (-13.33%)
Mutual labels:  django-application

Djano-Anti-Crawler

PyPI version

A light weight anti crawler Django app which blocks the IP addresses which sends too many hits to your application. You can decide the number of hits that are allowed per IP address in defined time.

Installation

  1. Install via pip

    pip install django-anti-crawler
    

Quick start

  1. Add django_anti_crawler to your INSTALLED_APPS setting like this::

    INSTALLED_APPS = [
        ...
        'django_anti_crawler',
    ]
    
  2. Add 'DjangoAntiCrawlerMiddleware' to your middleware classes in settings.py file::

    MIDDLEWARE = [
        'django_anti_crawler.middlewares.DjangoAntiCrawlerMiddleware',
        'django.middleware.security.SecurityMiddleware',
        'django.contrib.sessions.middleware.SessionMiddleware',
        'django.middleware.common.CommonMiddleware',
        'django.middleware.csrf.CsrfViewMiddleware',
        'django.contrib.auth.middleware.AuthenticationMiddleware',
        'django.contrib.messages.middleware.MessageMiddleware',
        'django.middleware.clickjacking.XFrameOptionsMiddleware',
    ]
    

    DjangoAntiCrawlerMiddleware can be and should be first middleware as we need to make sure IP check is the very first thing in processing request.

  3. If cache settings are not defined in your settings.py file, then you need to add below lines to your settings.py file::

    CACHES = {
        'default': {
            'BACKEND': 'django.core.cache.backends.db.DatabaseCache',
            'LOCATION': 'cache_table',
        }
    }
    

    Make sure you have database settings configured. Run the below command to create cache_table in database::

    python manage.py createcachetable
    

    You may choose whatever cache backend you want to use.

  4. (optional) Set variables in MAX_ALLOWED_HITS_PER_IP and IP_HITS_TIMEOUT in settings.py file::

    MAX_ALLOWED_HITS_PER_IP = 2000 # max allowed hits per IP_TIMEOUT time from an IP. Default 2000. IP_HITS_TIMEOUT = 60 # timeout in seconds for IP in cache. Default 60.

  5. (optional) Set variable ANTI_CRAWLER_WHITELIST_BOTS and IP_HITS_TIMEOUT in settings.py file to whitelist specific bots or Ips::

    To test on local system, set these values to very low, e.g. IP_HITS_TIMEOUT = 30 and MAX_ALLOWED_HITS_PER_IP = 2. Restart the server and send requests frequently. After two requests you will start receiving 403 error. If not defined in settings file, default values will be used.

Authors

Licensing

The project is MIT Licenced.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].