from django.core import exceptions class RateLimitHit(exceptions.SuspiciousOperation): def __init__(self, ip: str): self.text = f"You made to many request in a short period of time! Please try again later. Your IP: {ip}" def __str__(self): return f"{self.__class__.__name__}: {self.text}" class ProxyUsageDetected(exceptions.SuspiciousOperation): def __init__(self, proxy: str): self.text = f"It appears you are using a proxy! We don't want you to do that! Your Proxy IP: {proxy}" def __str__(self): return f"{self.__class__.__name__}: {self.text}"