mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-21 21:22:11 -03:00
- Add RateLimitError import and _make_request wrapper method to handle rate limiting - Update API methods to use _make_request wrapper instead of direct downloader calls - Add explicit RateLimitError handling in API methods to properly propagate rate limit errors - Add _extract_retry_after method to parse Retry-After headers - Improve error handling by surfacing rate limit information to callers These changes ensure that rate limiting from the Civitai API is properly detected and handled, allowing callers to implement appropriate backoff strategies when rate limits are encountered.
22 lines
500 B
Python
22 lines
500 B
Python
"""Common service-level exception types."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Optional
|
|
|
|
|
|
class RateLimitError(RuntimeError):
|
|
"""Raised when a remote provider rejects a request due to rate limiting."""
|
|
|
|
def __init__(
|
|
self,
|
|
message: str,
|
|
*,
|
|
retry_after: Optional[float] = None,
|
|
provider: Optional[str] = None,
|
|
) -> None:
|
|
super().__init__(message)
|
|
self.retry_after = retry_after
|
|
self.provider = provider
|
|
|