# HttpResponse<!-- -->

Protocol for HTTP response objects returned by HTTP clients.

Any object that has the required attributes and methods can be used as an HTTP response (e.g., `impit.Response`). This enables custom HTTP client implementations to return their own response types.

## Index[](#Index)

### Methods

* [aclose](https://docs.apify.com/api/client/python/reference/class/HttpResponse.md#aclose)
* [aiter_bytes](https://docs.apify.com/api/client/python/reference/class/HttpResponse.md#aiter_bytes)
* [aread](https://docs.apify.com/api/client/python/reference/class/HttpResponse.md#aread)
* [close](https://docs.apify.com/api/client/python/reference/class/HttpResponse.md#close)
* [iter_bytes](https://docs.apify.com/api/client/python/reference/class/HttpResponse.md#iter_bytes)
* [json](https://docs.apify.com/api/client/python/reference/class/HttpResponse.md#json)
* [read](https://docs.apify.com/api/client/python/reference/class/HttpResponse.md#read)

### Properties

* [content](https://docs.apify.com/api/client/python/reference/class/HttpResponse.md#content)
* [headers](https://docs.apify.com/api/client/python/reference/class/HttpResponse.md#headers)
* [status_code](https://docs.apify.com/api/client/python/reference/class/HttpResponse.md#status_code)
* [text](https://docs.apify.com/api/client/python/reference/class/HttpResponse.md#text)

## Methods<!-- -->[](#Methods)

### [](#aclose)aclose

* async **aclose**(): None

- Close the response and release the connection asynchronously.

  ***

  #### Returns None

### [](#aiter_bytes)aiter_bytes

* **aiter_bytes**(): AsyncIterator\[bytes]

- Iterate over the response body in bytes chunks asynchronously.

  ***

  #### Returns AsyncIterator\[bytes]

### [](#aread)aread

* async **aread**(): bytes

- Read the entire response body asynchronously.

  ***

  #### Returns bytes

### [](#close)close

* **close**(): None

- Close the response and release the connection.

  ***

  #### Returns None

### [](#iter_bytes)iter_bytes

* **iter_bytes**(): Iterator\[bytes]

- Iterate over the response body in bytes chunks.

  ***

  #### Returns Iterator\[bytes]

### [](#json)json

* **json**(): Any

- Parse response body as JSON.

  ***

  #### Returns Any

### [](#read)read

* **read**(): bytes

- Read the entire response body.

  ***

  #### Returns bytes

## Properties<!-- -->[](#Properties)

### [](#content)content

content: bytes

Raw response body as bytes.

### [](#headers)headers

headers: Mapping\[str, str]

Response headers as a mapping.

### [](#status_code)status_code

status_code: int

HTTP status code of the response.

### [](#text)text

text: str

Response body decoded as text.
