security(polymarket-browse): add token bucket rate limiter for API calls #36
Reference in New Issue
Block a user
Delete Branch "security/10-rate-limiting"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Add token bucket rate limiter to prevent overwhelming the Polymarket API.
Changes
RateLimiterclass using token bucket algorithmThreadPoolExecutorRATE_LIMIT_CALLS = 10perRATE_LIMIT_WINDOW = 1.0second_rate_limiter.acquire()called before each API requestMAX_RESPONSE_SIZEcheck (10MB limit)Design
_lockTesting
70/70 tests passing
Review requested
for the MAX_RESPONSE_SIZE I think you should wait the PR #35 to be merged first. the rest is ok we can merge them
lgtm
Pull request closed