Skip to main content

HttpResponse

Define the interface that any HTTP response object must implement.

Index

Methods

read

  • Read the entire content of the response body.

    This method loads the complete response body into memory at once. It should be used for responses received from regular HTTP requests (via send_request or crawl methods).


    Returns bytes

read_stream

  • read_stream(): AsyncIterator[bytes]
  • 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 yielding chunks sequentially.


    Returns AsyncIterator[bytes]

Properties

headers

headers: HttpHeaders

The HTTP headers received in the response.

http_version

http_version: str

The HTTP version used in the response.

status_code

status_code: int

The HTTP status code received from the server.