mirror of
https://github.com/ae-utbm/sith3.git
synced 2024-09-19 17:38:10 +00:00
16 lines
453 B
Python
16 lines
453 B
Python
import logging
|
|
from time import localtime, strftime
|
|
from typing import Any
|
|
|
|
from django.http import HttpRequest, HttpResponse
|
|
|
|
|
|
def custom_honeypot_error(
|
|
request: HttpRequest, context: dict[str, Any]
|
|
) -> HttpResponse:
|
|
logging.warning(
|
|
f"[{strftime('%c', localtime())}] "
|
|
f"HoneyPot blocked user with ip {request.META.get('X-Forwarded-For')}"
|
|
)
|
|
return HttpResponse("Upon reading this, the http client was enlightened.")
|