class documentation

class Response(response.Response):

Constructor: Response(body)

View In Hierarchy

Response object for HTTP requests.

Method __init__ Initialize the response with the given body.
Method __setattr__ Set a response attribute, routing to the matching setter.
Method close Close the response and release any resources.
Method json Convert the response content to a JSON object.
Instance Variable content The raw response body.
Instance Variable encoding The character encoding of the response.
Instance Variable headers The HTTP headers of the response.
Instance Variable reason The HTTP reason phrase.
Instance Variable status_code The HTTP status code of the response.
Instance Variable text The response body decoded as a string.
def __init__(self, body: bytes):

Initialize the response with the given body.

Parameters
body:bytesThe raw response body.
def __setattr__(self, name, value):

Set a response attribute, routing to the matching setter.

Parameters
name:strAttribute name to set.
value:objectNew value for the attribute.
def close(self):

Close the response and release any resources.

def json(self) -> dict:

Convert the response content to a JSON object.

Returns
dictThe parsed JSON object.
content: bytes =

The raw response body.

encoding: str =

The character encoding of the response.

headers: dict =

The HTTP headers of the response.

reason: str =

The HTTP reason phrase.

status_code: int =

The HTTP status code of the response.

text: str =

The response body decoded as a string.