Session
Implements a ClientSession which is also capable of caching response payload data to a backend.
Classes:
|
A modified session which attempts to get/save responses from/to a stored cache before/after sending it. |
- class aiorequestful.cache.session.CachedSession(cache, **kwargs)
Bases:
ClientSessionA modified session which attempts to get/save responses from/to a stored cache before/after sending it.
- Parameters:
cache (
ResponseCache) – The cache to use for managing cached responses.
Attributes:
The
logging.Loggerfor this objectThe cache to use when attempting to return a cached response.
Methods:
request([persist])Perform HTTP request.
- logger: logging.Logger
The
logging.Loggerfor this object
- cache
The cache to use when attempting to return a cached response.
- request(persist=True, **kwargs)
Perform HTTP request.
Arguments passed through to .aiohttp.ClientSession.request. See aiohttp reference for more info on available kwargs: https://docs.aiohttp.org/en/stable/client_reference.html#aiohttp.ClientSession.request
- Parameters:
persist (
bool(default:True)) – Whether to persist responses returned from sending network requests i.e. non-cached responses.- Returns:
Either the
CachedResponseif a response was found in the cache, or theClientResponseif the request was sent.