aiohttp_client_cache.response module¶
-
class
aiohttp_client_cache.response.
CachedResponse
(method, reason, status, url, version, body=None, content_disposition=None, cookies=None, created_at=NOTHING, encoding=None, expires=None, headers=NOTHING, history=NOTHING, request_info=None)[source]¶ Bases:
object
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.-
_body
: Any¶
-
content_disposition
: aiohttp.client_reqrep.ContentDisposition¶
-
created_at
: datetime.datetime¶
-
encoding
: str¶
-
expires
: datetime.datetime¶
-
async classmethod
from_client_response
(client_response, expire_after=None)[source]¶ Convert a ClientResponse into a CachedReponse
- Parameters
client_response (aiohttp.client_reqrep.ClientResponse) –
expire_after (datetime.timedelta) –
-
headers
: Mapping¶
-
history
: Iterable¶
-
property
is_expired
¶ Determine if this cached response is expired
- Return type
bool
-
async
json
(encoding=None, **kwargs)[source]¶ Read and decode JSON response
- Return type
Optional
[Dict
[str
,Any
]]- Parameters
encoding (Optional[str]) –
-
method
: str¶
-
property
ok
¶ Returns
True
ifstatus
is less than400
,False
if not- Return type
bool
-
reason
: str¶
-
request_info
: aiohttp_client_cache.response.RequestInfo¶
-
status
: int¶
-
async
text
(encoding=None, errors='strict')[source]¶ Read response payload and decode
- Return type
str
- Parameters
encoding (Optional[str]) –
errors (str) –
-
url
: Union[str, yarl.URL]¶
-
version
: str¶
-