(*args, **kwargs)
| 52 | def decorator(fn): |
| 53 | @wraps(fn) |
| 54 | def wrapper(*args, **kwargs): |
| 55 | key = f"{fn.__name__}:{_identity_key()}" |
| 56 | allowed, remaining, retry = _limiter.check(key, limit, window) |
| 57 | if not allowed: |
| 58 | resp, status = error_response("RATE_LIMITED") |
| 59 | resp.headers["Retry-After"] = str(int(retry) + 1) |
| 60 | resp.headers["X-RateLimit-Limit"] = str(limit) |
| 61 | resp.headers["X-RateLimit-Remaining"] = "0" |
| 62 | return resp, status |
| 63 | result = fn(*args, **kwargs) |
| 64 | return result |
| 65 | |
| 66 | return wrapper |
| 67 |
nothing calls this directly
no test coverage detected