Files
openrouter-python-sdk-retry…/src/openrouter/errors/toomanyrequestsresponse_error.py
T
Matt Apperson 5fc522c72f Initial commit: OpenRouter Python SDK
Auto-generated Python SDK for OpenRouter API, providing comprehensive client library with:
- Chat completions and streaming support
- Embeddings API
- Model and provider information
- API key management
- Analytics and usage tracking
- OAuth authentication flows
- Full type hints and error handling
2025-11-13 10:56:25 -05:00

37 lines
1.2 KiB
Python

"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from dataclasses import dataclass, field
import httpx
from openrouter.errors import OpenRouterError
from openrouter.models import (
toomanyrequestsresponseerrordata as models_toomanyrequestsresponseerrordata,
)
from openrouter.types import BaseModel, OptionalNullable, UNSET
from typing import Optional
class TooManyRequestsResponseErrorData(BaseModel):
error: models_toomanyrequestsresponseerrordata.TooManyRequestsResponseErrorData
r"""Error data for TooManyRequestsResponse"""
user_id: OptionalNullable[str] = UNSET
@dataclass(unsafe_hash=True)
class TooManyRequestsResponseError(OpenRouterError):
r"""Too Many Requests - Rate limit exceeded"""
data: TooManyRequestsResponseErrorData = field(hash=False)
def __init__(
self,
data: TooManyRequestsResponseErrorData,
raw_response: httpx.Response,
body: Optional[str] = None,
):
fallback = body or raw_response.text
message = str(data.error.message) or fallback
super().__init__(message, raw_response, body)
object.__setattr__(self, "data", data)