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.

  • sessionHttpSession object which created corresponding HttpRequest for this response.

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

assert_headers(headers: dict, *, msg=None)

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


headers – HTTP headers dictionary

Keyword Arguments

msg – Purpose of this assertion

assert_status_codes(codes, *, msg=None)

Assert that the status code is as expected.


codes – str or iterator

Keyword Arguments

msg – Purpose of this assertion

property content

HTTP Response content as plain unformatted text.

property html

HTTP Response content as Arjuna’s HtmlNode object.

property is_redirect

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

property json

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

property last_redir_response

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

Query parameters in URL for this response.

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

property redir_history

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

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

HttpRequest object corresponding to this response object.

property status

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

property status_code

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

URL for which this response was generated.

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