mirror of
				https://github.com/ae-utbm/sith.git
				synced 2025-11-04 02:53:06 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			18 lines
		
	
	
		
			478 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			18 lines
		
	
	
		
			478 B
		
	
	
	
		
			Python
		
	
	
	
	
	
import logging
 | 
						|
from time import localtime, strftime
 | 
						|
from typing import Any
 | 
						|
 | 
						|
from django.http import HttpRequest, HttpResponse
 | 
						|
 | 
						|
from core.utils import get_client_ip
 | 
						|
 | 
						|
 | 
						|
def custom_honeypot_error(
 | 
						|
    request: HttpRequest, context: dict[str, Any]
 | 
						|
) -> HttpResponse:
 | 
						|
    logging.warning(
 | 
						|
        f"[{strftime('%c', localtime())}] "
 | 
						|
        f"HoneyPot blocked user with ip {get_client_ip(request)}"
 | 
						|
    )
 | 
						|
    return HttpResponse("Upon reading this, the http client was enlightened.")
 |