(self, ip: str)
| 72 | self.minutes = minutes |
| 73 | |
| 74 | def check_ip(self, ip: str) -> bool: |
| 75 | if ip in self.ips: |
| 76 | ip_info = self.ips[ip] |
| 77 | if ip_info["count"] >= self.count: |
| 78 | if ip_info["time"] + timedelta(minutes=self.minutes) > datetime.now(): |
| 79 | return False |
| 80 | self.ips.pop(ip) |
| 81 | return True |
| 82 | |
| 83 | def add_ip(self, ip: str) -> int: |
| 84 | ip_info = self.ips.get(ip, {"count": 0, "time": datetime.now()}) |