cache_requests package

cache_requests

Simple. Powerful. Persistent LRU caching for the requests library.

class cache_requests.Session(ex=None, connection=None)[source]

Bases: requests.sessions.Session

requests.Session with memoized methods.

class cache_requests.Memoize(func=None, ex=None, connection=None)[source]

Bases: object

Decorator class. Implements LRU cache pattern that syncs cache with redislite storage.

put_cache_results(key, func_akw, set_cache_cb)[source]

Put function results into cache.

redis

Provide access to the redis connection handle.

Submodules

cache_requests._compat

Python 2to3 compatibility handling.

class cache_requests._compat.NullHandler(level=0)[source]

Bases: logging.Handler

This handler does nothing. It’s intended to be used to avoid the “No handlers could be found for logger XXX” one-off warning. This is important for library code, which may contain code to log events. If a user of the library does not configure logging, the one-off warning might be produced; to avoid this, the library developer simply needs to instantiate a NullHandler and add it to the top-level logger of the library module or package.

createLock()[source]
emit(record)[source]
handle(record)[source]

cache_requests.memoize

Memoize cache decorator.

Public Api

Source

class cache_requests.memoize.Memoize(func=None, ex=None, connection=None)[source]

Bases: object

Decorator class. Implements LRU cache pattern that syncs cache with redislite storage.

put_cache_results(key, func_akw, set_cache_cb)[source]

Put function results into cache.

redis

Provide access to the redis connection handle.

cache_requests.sessions

Extend requests with cache decorator.

Public Api

Source

class cache_requests.sessions.MemoizeRequest(func=None, **kwargs)[source]

Bases: cache_requests.memoize.Memoize

Cache session method calls.

ex
redis
use_cache
class cache_requests.sessions.CacheConfig(**kwargs)[source]

Bases: cache_requests.utils.AttributeDict

A strict dict with attribute access.

class cache_requests.sessions.Session(ex=None, connection=None)[source]

Bases: requests.sessions.Session

requests.Session with memoized methods.

cache_requests.utils

Package utilities.

Source

class cache_requests.utils.AttributeDict(**kwargs)[source]

Bases: object

Strict dict with attribute access

cache_requests.utils.deep_hash(*args, **kwargs)[source]
cache_requests.utils.normalize_signature(func)[source]

Decorator. Combine args and kwargs. Unpack single item tuples.

cache_requests.utils.make_callback(value)[source]

Convert bool values to callback

cache_requests.utils.temp_file(name)[source]