File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed
Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -63,9 +63,8 @@ def __stream__(self) -> Iterator[_T]:
6363 for sse in iterator :
6464 yield process_data (data = sse .json (), cast_to = cast_to , response = response )
6565
66- # Ensure the entire stream is consumed
67- for _sse in iterator :
68- ...
66+ # As we might not fully consume the response stream, we need to close it explicitly
67+ response .close ()
6968
7069 def __enter__ (self ) -> Self :
7170 return self
@@ -127,9 +126,8 @@ async def __stream__(self) -> AsyncIterator[_T]:
127126 async for sse in iterator :
128127 yield process_data (data = sse .json (), cast_to = cast_to , response = response )
129128
130- # Ensure the entire stream is consumed
131- async for _sse in iterator :
132- ...
129+ # As we might not fully consume the response stream, we need to close it explicitly
130+ await response .aclose ()
133131
134132 async def __aenter__ (self ) -> Self :
135133 return self
You can’t perform that action at this time.
0 commit comments