MCPcopy Create free account
hub / github.com/apify/crawlee-python / read_stream

Method read_stream

src/crawlee/http_clients/_base.py:48–58  ·  view source on GitHub ↗

Iterate over the content of the response body in chunks. This method should be used for responses received from the `stream` method to process large response bodies without loading them entirely into memory. It allows for efficient processing of potentially large data by yie

(self)

Source from the content-addressed store, hash-verified

46 """
47
48 def read_stream(self) -> AsyncIterator[bytes]:
49 """Iterate over the content of the response body in chunks.
50
51 This method should be used for responses received from the `stream` method to process
52 large response bodies without loading them entirely into memory. It allows for efficient
53 processing of potentially large data by yielding chunks sequentially.
54
55 Raises:
56 RuntimeError: If the stream has already been consumed or if the response was not obtained from the `stream`
57 method.
58 """
59
60
61@dataclass(frozen=True)

Calls

no outgoing calls