rate_limiter
- class google_scholar_search_mcp.rate_limiter.RateLimiter(min_delay=5.0, max_delay=15.0)[source]
Bases:
objectSerializes requests with a random delay and retries on rate limiting.
- async execute(func, *args, max_retries=3, **kwargs)[source]
Run a blocking function in a thread, throttled and with retries.
- Parameters:
func (Callable[..., Any]) – Blocking callable to execute.
*args (Any) – Positional arguments for
func.max_retries (int) – Retries after a rate-limit error, with exponential backoff (default 3).
**kwargs (Any) – Keyword arguments for
func.
- Returns:
Any – Whatever
funcreturns.- Raises:
ScholarBlockedError – If Scholar blocks the client (CAPTCHA, max tries exceeded).
ScholarRateLimitError – If Scholar keeps throttling the request after all retries.
Exception – Any other error raised by
funcis re-raised.
- Return type: