Skip to content

Commit e636aca

Browse files
chore(internal): add request options to SSE classes
1 parent 836f18d commit e636aca

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

src/runloop_api_client/_response.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
152152
),
153153
response=self.http_response,
154154
client=cast(Any, self._client),
155+
options=self._options,
155156
),
156157
)
157158

@@ -162,6 +163,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
162163
cast_to=extract_stream_chunk_type(self._stream_cls),
163164
response=self.http_response,
164165
client=cast(Any, self._client),
166+
options=self._options,
165167
),
166168
)
167169

@@ -175,6 +177,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
175177
cast_to=cast_to,
176178
response=self.http_response,
177179
client=cast(Any, self._client),
180+
options=self._options,
178181
),
179182
)
180183

src/runloop_api_client/_streaming.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
if TYPE_CHECKING:
3434
from ._client import Runloop, AsyncRunloop
35+
from ._models import FinalRequestOptions
3536

3637

3738
_T = TypeVar("_T")
@@ -41,7 +42,7 @@ class Stream(Generic[_T]):
4142
"""Provides the core interface to iterate over a synchronous stream response."""
4243

4344
response: httpx.Response
44-
45+
_options: Optional[FinalRequestOptions] = None
4546
_decoder: SSEBytesDecoder
4647

4748
def __init__(
@@ -50,10 +51,12 @@ def __init__(
5051
cast_to: type[_T],
5152
response: httpx.Response,
5253
client: Runloop,
54+
options: Optional[FinalRequestOptions] = None,
5355
) -> None:
5456
self.response = response
5557
self._cast_to = cast_to
5658
self._client = client
59+
self._options = options
5760
self._decoder = client._make_sse_decoder()
5861
self._iterator = self.__stream__()
5962

@@ -114,7 +117,7 @@ class AsyncStream(Generic[_T]):
114117
"""Provides the core interface to iterate over an asynchronous stream response."""
115118

116119
response: httpx.Response
117-
120+
_options: Optional[FinalRequestOptions] = None
118121
_decoder: SSEDecoder | SSEBytesDecoder
119122

120123
def __init__(
@@ -123,10 +126,12 @@ def __init__(
123126
cast_to: type[_T],
124127
response: httpx.Response,
125128
client: AsyncRunloop,
129+
options: Optional[FinalRequestOptions] = None,
126130
) -> None:
127131
self.response = response
128132
self._cast_to = cast_to
129133
self._client = client
134+
self._options = options
130135
self._decoder = client._make_sse_decoder()
131136
self._iterator = self.__stream__()
132137

0 commit comments

Comments
 (0)