exceptions.py 469 B

1234567891011121314151617
  1. from datetime import datetime
  2. from typing import Optional
  3. class ThrottleException(Exception):
  4. """
  5. 429 Too Many Requests Exception
  6. Supports optional retry_after kwarg seconds or Date
  7. https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429
  8. """
  9. retry_after: Optional[int | datetime]
  10. def __init__(self, retry_after: Optional[int | datetime] = None) -> None:
  11. self.retry_after = retry_after
  12. super().__init__(retry_after)