# Path: axes/conf.py

# 
# Path: axes/models.py
# class AccessBase(models.Model):
#     user_agent = models.CharField(_("User Agent"), max_length=255, db_index=True)
# 
#     ip_address = models.GenericIPAddressField(_("IP Address"), null=True, db_index=True)
# 
#     username = models.CharField(_("Username"), max_length=255, null=True, db_index=True)
# 
#     http_accept = models.CharField(_("HTTP Accept"), max_length=1025)
# 
#     path_info = models.CharField(_("Path"), max_length=255)
# 
#     attempt_time = models.DateTimeField(_("Attempt Time"), auto_now_add=True)
# 
#     class Meta:
#         app_label = "axes"
#         abstract = True
#         ordering = ["-attempt_time"]


from datetime import timedelta
from hashlib import md5
from logging import getLogger
from string import Template
from typing import Callable, Optional, Type, Union
from urllib.parse import urlencode
from django.core.cache import caches, BaseCache
from django.http import HttpRequest, HttpResponse, JsonResponse, QueryDict
from django.shortcuts import render, redirect
from django.utils.module_loading import import_string
from axes.conf import settings
from axes.models import AccessBase
import ipware.ip



log = getLogger(__name__)


def get_cache() -> BaseCache:
    """
    Get the cache instance Axes is configured to use with ``settings.AXES_CACHE`` and use ``'default'`` if not set.
    """


# Path: axes/conf.py

# 
# Path: axes/models.py
# class AccessBase(models.Model):
#     user_agent = models.CharField(_("User Agent"), max_length=255, db_index=True)
# 
#     ip_address = models.GenericIPAddressField(_("IP Address"), null=True, db_index=True)
# 
#     username = models.CharField(_("Username"), max_length=255, null=True, db_index=True)
# 
#     http_accept = models.CharField(_("HTTP Accept"), max_length=1025)
# 
#     path_info = models.CharField(_("Path"), max_length=255)
# 
#     attempt_time = models.DateTimeField(_("Attempt Time"), auto_now_add=True)
# 
#     class Meta:
#         app_label = "axes"
#         abstract = True
#         ordering = ["-attempt_time"]


# Path: axes/helpers.py
from datetime import timedelta
from hashlib import md5
from logging import getLogger
from string import Template
from typing import Callable, Optional, Type, Union
from urllib.parse import urlencode
from django.core.cache import caches, BaseCache
from django.http import HttpRequest, HttpResponse, JsonResponse, QueryDict
from django.shortcuts import render, redirect
from django.utils.module_loading import import_string
from axes.conf import settings
from axes.models import AccessBase
import ipware.ip




log = getLogger(__name__)


def get_cache() -> BaseCache:
    """
    Get the cache instance Axes is configured to use with ``settings.AXES_CACHE`` and use ``'default'`` if not set.
    """


    return caches[getattr(settings, "AXES_CACHE", "default")]