response#
Summary#
|
A dataclass containing cached response information, used for serialization. |
|
A StreamReader loaded from previously consumed response content. |
|
Set some default CachedResponse values on a ClientResponse object, so they can be expected to always be present |
Module Contents#
- class CachedResponse(method, reason, status, url, version, body=b'', content=None, links=NOTHING, cookies=NOTHING, created_at=NOTHING, encoding='utf-8', expires=None, raw_headers=NOTHING, real_url=None, history=NOTHING, last_used=NOTHING)#
Bases:
aiohttp.helpers.HeadersMixin
A dataclass containing cached response information, used for serialization. It will mostly behave the same as a
aiohttp.ClientResponse
that has been read, with some additional cache-related info.- Parameters
- Return type
None
- _body: Any#
-
_content:
aiohttp.StreamReader
#
- property _headers: multidict._multidict.CIMultiDictProxy#
- Return type
CIMultiDictProxy
- property _released#
- async close()#
- property connection#
-
property content:
aiohttp.StreamReader
# - Return type
-
property content_disposition: Optional[
aiohttp.ContentDisposition
]# Get Content-Disposition headers, if any
- Return type
- cookies: http.cookies.SimpleCookie#
- created_at: datetime.datetime#
- expires: Optional[datetime.datetime]#
- property from_cache#
- async classmethod from_client_response(client_response, expires=None)#
Convert a ClientResponse into a CachedReponse
- Parameters
client_response (
ClientResponse
) –
- get_encoding()#
- property headers: multidict._multidict.CIMultiDictProxy#
Get headers as an immutable, case-insensitive multidict from raw headers
- Return type
CIMultiDictProxy
- history: Iterable#
- async json(encoding=None, **kwargs)#
Read and decode JSON response
- last_used: datetime.datetime#
- property links: multidict._multidict.MultiDictProxy#
Convert stored links into the format returned by
ClientResponse.links
- Return type
MultiDictProxy
- raise_for_status()#
- release()#
-
property request_info:
aiohttp.RequestInfo
# - Return type
- reset()#
Reset the stream reader to re-read a streamed response
- async start()#
- async terminate()#
- async text(encoding=None, errors='strict')#
Read response payload and decode
- url: yarl.URL#
- async wait_for_close()#
- class CachedStreamReader(body=None)#
Bases:
aiohttp.StreamReader
A StreamReader loaded from previously consumed response content. This feeds cached data into the stream so it can support all the same behavior as the original stream: async iteration, chunked reads, etc.
- set_response_defaults(response)#
Set some default CachedResponse values on a ClientResponse object, so they can be expected to always be present
- Parameters
response (
Union
[ClientResponse
,CachedResponse
]) –- Return type