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

Method stream

src/crawlee/http_clients/_base.py:160–190  ·  view source on GitHub ↗

Stream an HTTP request via the client. This method should be used for downloading potentially large data where you need to process the response body in chunks rather than loading it entirely into memory. Args: url: The URL to send the request to. met

(
        self,
        url: str,
        *,
        method: HttpMethod = 'GET',
        headers: HttpHeaders | dict[str, str] | None = None,
        payload: HttpPayload | None = None,
        session: Session | None = None,
        proxy_info: ProxyInfo | None = None,
        timeout: timedelta | None = None,
    )

Source from the content-addressed store, hash-verified

158
159 @abstractmethod
160 def stream(
161 self,
162 url: str,
163 *,
164 method: HttpMethod = 'GET',
165 headers: HttpHeaders | dict[str, str] | None = None,
166 payload: HttpPayload | None = None,
167 session: Session | None = None,
168 proxy_info: ProxyInfo | None = None,
169 timeout: timedelta | None = None,
170 ) -> AbstractAsyncContextManager[HttpResponse]:
171 """Stream an HTTP request via the client.
172
173 This method should be used for downloading potentially large data where you need to process
174 the response body in chunks rather than loading it entirely into memory.
175
176 Args:
177 url: The URL to send the request to.
178 method: The HTTP method to use.
179 headers: The headers to include in the request.
180 payload: The data to be sent as the request body.
181 session: The session associated with the request.
182 proxy_info: The information about the proxy to be used.
183 timeout: The maximum time to wait for establishing the connection.
184
185 Raises:
186 ProxyError: Raised if a proxy-related error occurs.
187
188 Returns:
189 An async context manager yielding the HTTP response with streaming capabilities.
190 """
191
192 @abstractmethod
193 async def cleanup(self) -> None:

Callers 7

iterate_keysMethod · 0.45
test_streamFunction · 0.45

Calls

no outgoing calls