Session

Inheritance diagram of aiorequestful.cache.session

Implements a ClientSession which is also capable of caching response payload data to a backend.

Classes:

CachedSession(cache, **kwargs)

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: ClientSession

A 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:

logger

The logging.Logger for this object

cache

The cache to use when attempting to return a cached response.

Methods:

request([persist])

Perform HTTP request.

logger: logging.Logger

The logging.Logger for 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 CachedResponse if a response was found in the cache, or the ClientResponse if the request was sent.