Skip to content

Raise RatelimitException for HTTP 429 responses#479

Open
KetanHegde wants to merge 1 commit into
deedy5:mainfrom
KetanHegde:fix/raise-ratelimit-exception
Open

Raise RatelimitException for HTTP 429 responses#479
KetanHegde wants to merge 1 commit into
deedy5:mainfrom
KetanHegde:fix/raise-ratelimit-exception

Conversation

@KetanHegde

Copy link
Copy Markdown

Summary

Closes #478.

This PR raises RatelimitException when a search engine request receives an HTTP 429 response, allowing callers to distinguish rate limiting from other DDGSException errors.

Additionally, _search_sync() now preserves RatelimitException by re-raising it instead of wrapping it as a generic DDGSException.

Changes

  • Raise RatelimitException for HTTP 429 responses in BaseSearchEngine.request().
  • Preserve RatelimitException in DDGS._search_sync() by re-raising it.

Testing

  • Ran ruff check .
  • Ran pytest

All tests passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RatelimitException is defined but never raised — users cannot catch rate limits distinctly

1 participant