Get the current count of requests for the given IP within the rate limit window. This is primarily used for testing.
(ip: str)
| 58 | |
| 59 | |
| 60 | def get_count(ip: str) -> int: |
| 61 | """ |
| 62 | Get the current count of requests for the given IP within the rate limit window. |
| 63 | This is primarily used for testing. |
| 64 | """ |
| 65 | key, now = _key(ip), _now_us() |
| 66 | return cache.zcount(key, now - WINDOW_US, now) |