| 119 | |
| 120 | |
| 121 | class ResponseStream(SyncByteStream): |
| 122 | def __init__(self, httpcore_stream: typing.Iterable[bytes]) -> None: |
| 123 | self._httpcore_stream = httpcore_stream |
| 124 | |
| 125 | def __iter__(self) -> typing.Iterator[bytes]: |
| 126 | with map_httpcore_exceptions(): |
| 127 | for part in self._httpcore_stream: |
| 128 | yield part |
| 129 | |
| 130 | def close(self) -> None: |
| 131 | if hasattr(self._httpcore_stream, "close"): |
| 132 | self._httpcore_stream.close() |
| 133 | |
| 134 | |
| 135 | class HTTPTransport(BaseTransport): |