INNER CODE UNIT · Python
__init__
Kounex/obs_blade · tool/kick_auth_proxy/proxy.py:78
def __init__(self, status: int, message: str):
super().__init__(message)
self.status = status
self.message = message
def _allow(ip: str, now: float | None = None) -> bool:
moment = time.monotonic() if now is None else now
bucket = _hits[ip]
while bucket and moment - bucket[0] > WINDOW_SECONDS:
bucket.popleft()
if len(bucket) >= MAX_PER_WINDOW:
return False
bucket.append(moment)
return True
def build_upstream(form: dict[str, str]) -> dict[str, str]: