Skip to content

IconifyRateLimitError

Base classes

Name Children Inherits
IconifyError
pycons.iconify.errors
Base class for errors when fetching Iconify data.

⋔ Inheritance diagram

graph TD
  2230050271["errors.IconifyRateLimitError"]
  2897084011["errors.IconifyError"]
  1615621424["builtins.Exception"]
  3224121899["builtins.BaseException"]
  2751680898["builtins.object"]
  2897084011 --> 2230050271
  1615621424 --> 2897084011
  3224121899 --> 1615621424
  2751680898 --> 3224121899

🛈 DocStrings

Bases: IconifyError

Request was rejected by the rate limiter (HTTP 429).

The public Iconify API is meant for loading icons on demand. Bulk data (whole icon sets) should come from the CDN or a self-hosted API instance. See https://iconify.design/docs/api/ ("Limits").

Source code in src/pycons/iconify/errors.py
class IconifyRateLimitError(IconifyError):
    """Request was rejected by the rate limiter (HTTP 429).

    The public Iconify API is meant for loading icons on demand. Bulk data
    (whole icon sets) should come from the CDN or a self-hosted API instance.
    See https://iconify.design/docs/api/ ("Limits").
    """

    def __init__(self, url: str, retry_after: int | None) -> None:
        wait = f"retry after {retry_after}s" if retry_after is not None else "retry later"
        msg = (
            f"Rate limited by Iconify ({wait}): {url}. "
            "Use the CDN for bulk data or point PYCONS_ICONIFY_API to a self-hosted instance."
        )
        super().__init__(msg, url)
        self.retry_after = retry_after

:fa-brands-github: Show source on GitHub