Download data/src/elevenlabs/core/http_response.py from introvoyz045/elevenlabs-python: direct link, hf CLI and curl.
- Browser
- Download file 1.44 kB
-
https://huggingface.co/datasets/introvoyz045/elevenlabs-python/resolve/main/data/src/elevenlabs/core/http_response.py
- Command line
-
hf download hf://datasets/introvoyz045/elevenlabs-python/data/src/elevenlabs/core/http_response.py
-
curl -L -o http_response.py https://huggingface.co/datasets/introvoyz045/elevenlabs-python/resolve/main/data/src/elevenlabs/core/http_response.py
1.44 kB
| # This file was auto-generated by Fern from our API Definition. | |
| from typing import Dict, Generic, TypeVar | |
| import httpx | |
| # Generic to represent the underlying type of the data wrapped by the HTTP response. | |
| T = TypeVar("T") | |
| class BaseHttpResponse: | |
| """Minimalist HTTP response wrapper that exposes response headers and status code.""" | |
| _response: httpx.Response | |
| def __init__(self, response: httpx.Response): | |
| self._response = response | |
| def headers(self) -> Dict[str, str]: | |
| return dict(self._response.headers) | |
| def status_code(self) -> int: | |
| return self._response.status_code | |
| class HttpResponse(Generic[T], BaseHttpResponse): | |
| """HTTP response wrapper that exposes response headers and data.""" | |
| _data: T | |
| def __init__(self, response: httpx.Response, data: T): | |
| super().__init__(response) | |
| self._data = data | |
| def data(self) -> T: | |
| return self._data | |
| def close(self) -> None: | |
| self._response.close() | |
| class AsyncHttpResponse(Generic[T], BaseHttpResponse): | |
| """HTTP response wrapper that exposes response headers and data.""" | |
| _data: T | |
| def __init__(self, response: httpx.Response, data: T): | |
| super().__init__(response) | |
| self._data = data | |
| def data(self) -> T: | |
| return self._data | |
| async def close(self) -> None: | |
| await self._response.aclose() | |