mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-07-31 12:30:30 +08:00
27 lines
717 B
Python
27 lines
717 B
Python
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
|
|
import httpx
|
|
from typing import Optional
|
|
|
|
|
|
class OpenRouterError(Exception):
|
|
"""The base class for all HTTP error responses."""
|
|
|
|
message: str
|
|
status_code: int
|
|
body: str
|
|
headers: httpx.Headers
|
|
raw_response: httpx.Response
|
|
|
|
def __init__(
|
|
self, message: str, raw_response: httpx.Response, body: Optional[str] = None
|
|
):
|
|
self.message = message
|
|
self.status_code = raw_response.status_code
|
|
self.body = body if body is not None else raw_response.text
|
|
self.headers = raw_response.headers
|
|
self.raw_response = raw_response
|
|
|
|
def __str__(self):
|
|
return self.message
|