2022-08-03 21:00:33 +02:00
|
|
|
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}"
|
2022-08-03 21:00:33 +02:00
|
|
|
|
|
|
|
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}"
|
2022-08-03 21:00:33 +02:00
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return f"{self.__class__.__name__}: {self.text}"
|