Skip to content

Response

async_boto.core.response

AsyncRequestResponse

AsyncRequestResponse(status_code, url, headers=None, json=None, text=None)

Class to create a response object, which allows to retrieve async response outside the asyncio loop.

PARAMETER DESCRIPTION
status_code

status code from request.

TYPE: int

url

the url that was requested.

TYPE: str

json

the request json object, by default None

TYPE: dict DEFAULT: None

text

the response as text, by default None

TYPE: bytes DEFAULT: None

Source code in async_boto/core/response.py
23
24
25
26
27
28
29
30
31
32
33
34
35
def __init__(
    self,
    status_code: int,
    url: str,
    headers: dict[str, Any] | None = None,
    json: dict[str, Any] | None = None,
    text: str | None = None,
):
    self.url = url
    self._status_code = status_code
    self._text = text
    self._json = json
    self._headers = headers

url instance-attribute

url = url

json property

json

content property

content

status_code property

status_code

headers property

headers

raise_for_status

raise_for_status()

Method to raise a APIResponseError, if the status code of a request is higher 400.

RAISES DESCRIPTION
APIResponseError

if status code is >= 400

Source code in async_boto/core/response.py
53
54
55
56
57
58
59
60
61
62
63
64
def raise_for_status(self):
    """
    Method to raise a APIResponseError, if the status code of a request is
    higher 400.

    Raises
    ------
    APIResponseError
        if status code is >= 400
    """
    if self.status_code >= 300:
        ErrorFactory.raise_error_from_json(self.json)