rate_limiter

class google_scholar_search_mcp.rate_limiter.RateLimiter(min_delay=5.0, max_delay=15.0)[source]

Bases: object

Serializes 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 func returns.

Raises:
Return type:

Any