Response

class py42.response.Py42Response(requests_response)

Bases: object

property encoding

The encoding used to decode the response text.

property headers

A case-insensitive dictionary of response headers.

iter_content(chunk_size=1, decode_unicode=False)

Iterates over the response data. When stream=True is set on the request, this avoids reading the content at once into memory for large responses.

Parameters
  • chunk_size (int, optional) – The number of bytes it should read into memory. A value of None will function differently depending on the value of stream. stream=True will read data as it arrives in whatever size the chunks are received. If stream=False, data is returned as a single chunk. This is not necessarily the length of each item. Defaults to 1.

  • decode_unicode (bool, optional) – If True, content will be decoded using the best available encoding based on the response. Defaults to False.

property raw_text

The response.Response.text property. It contains raw metadata that is not included in the Py42Response.text property.

property status_code

An integer code of the response HTTP Status, e.g. 404 or 200.

property text

The more useful parts of the HTTP response dumped into a dictionary.

property url

The final URL location of response.