arjuna.tpi.httpauto.response module

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

Bases: arjuna.tpi.httpauto.message.HttpMessage

Encapsulates HTTP response message. 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_status_codes(codes, *, msg)

Assert that the status code is as expected.

Parameters:codes – str or iterator
Keyword Arguments:
 msg – Purpose of this assertion
content

HTTP Response content as plain text.

html

HTTP Response content as Arjuna’s HtmlNode object.

is_redirect

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

json

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

last_redir_response

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

next_request

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

query_params

Query parameters in URL for this response.

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

redir_history

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

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

HttpRequest object corresponding to this response object.

status

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

status_code

HTTP Status code for this response. For example, 200

text

HTTP Response content as plain text.

url

URL for which this response was generated.

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