arjuna.tpi.httpauto.response module

class arjuna.tpi.httpauto.response.HttpResponse(session, response)

Bases: arjuna.tpi.httpauto.packet.HttpPacket

Encapsulates HTTP response packet. Contains redirected responses as redirection history, if applicable.

Parameters
  • sessionHttpSession object which created corresponding HttpRequest for this response.

  • responserequests library’s Response object wrapped by this class.

assert_headers(headers: dict, *, msg)

Assert that all headers in provided in the headers dict are matched in response.

Parameters

headers – HTTP headers dictionary

Keyword Arguments

msg – Purpose of this assertion

assert_status_codes(codes, *, msg)

Assert that the status code is as expected.

Parameters

codes – str or iterator

Keyword Arguments

msg – Purpose of this assertion

property content

HTTP Response content as plain unformatted text.

property html: HtmlNode

HTTP Response content as Arjuna’s HtmlNode object.

property is_redirect

Is True if this is a response is a redirection response.

property json: JsonDictOrJsonList

HTTP Response content as Arjuna’s JsonDict or JsonList object.

property last_redir_response: arjuna.tpi.httpauto.response.HttpResponse

Last HttpResponse object in case of redirections. None in case of no reidrections.

property next_request

Next HttpRequest object if this response redirects to another request. None in case this is the last response in chain.

property query_params: dict

Query parameters in URL for this response.

In case of redirections, these are the query parameters in last request.

property redir_history: tuple

Ordered HttpResponse objects for all redirections that led to this response.

classmethod repr_as_str(*, status_code, status_msg, headers, content=None)
property request

HttpRequest object corresponding to this response object.

property status: str

HTTP Status Message for this response. For example, Not Found

property status_code: int

HTTP Status code for this response. For example, 200

property store

Values extracted from response and stored.

property text

HTTP Response content as Text object.

property url: str

URL for which this response was generated.

In case of redirections, this is the last URL requested.