1
0
clubhaus-schornbach/clubhaus/homepage/exceptions.py

18 lines
603 B
Python
Raw Permalink Normal View History

from django.core import exceptions
class RateLimitHit(exceptions.SuspiciousOperation):
2022-08-07 23:06:45 +02:00
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):
2022-08-07 23:06:45 +02:00
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}"