Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(0.9) Initialize backend with install_cache() prior to patching requests.Session #619

Merged
merged 1 commit into from Apr 29, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion requests_cache/patcher.py
Expand Up @@ -13,7 +13,7 @@

import requests

from .backends import BackendSpecifier, BaseCache
from .backends import BackendSpecifier, BaseCache, init_backend
from .cache_control import ExpirationTime
from .session import CachedSession, OriginalSession

Expand Down Expand Up @@ -45,6 +45,7 @@ def install_cache(
session_factory: Session class to use. It must inherit from either
:py:class:`.CachedSession` or :py:class:`.CacheMixin`
"""
backend = init_backend(cache_name, backend, **kwargs)

class _ConfiguredCachedSession(session_factory): # type: ignore # See mypy issue #5865
def __init__(self):
Expand Down