human_requests.abstraction.response

Classes

FetchResponse

Represents the response of a request.

Module Contents

class FetchResponse[source]

Represents the response of a request.

request: FetchRequest[source]

The request that was made.

page: HumanPage[source]

The page that made the request.

url: URL[source]

The URL of the response. Due to redirects, it can differ from request.url.

headers: dict[source]

The headers of the response.

raw: bytes[source]

The raw body of the response.

status_code: int[source]

The status code of the response.

status_text: str[source]

Человеко-читаемое представление status_code

redirected: bool[source]

Был ли ответ сформировапн в следствии редиректа

type: Literal['basic', 'cors', 'error', 'opaque', 'opaqueredirect'][source]
duration: float[source]

The duration of the request in seconds.

end_time: float[source]

Current time in seconds since the Epoch.

property text: str[source]

The body of the response.

json() dict | list[source]
seconds_ago() float[source]

How long ago was the request?

async render(
retry: int = 2,
timeout: float | None = None,
wait_until: Literal['commit', 'load', 'domcontentloaded', 'networkidle'] = 'commit',
referer: str | None = None,
) HumanPage[source]

Renders the response content in the current browser. It will look like we requested it through the browser from the beginning.

Recommended to use in cases when the server returns a JS challenge instead of a response.