diff options
author | Jordan Cook <jordan.cook@pioneer.com> | 2022-06-14 00:10:22 -0500 |
---|---|---|
committer | Jordan Cook <jordan.cook@pioneer.com> | 2022-06-16 16:48:34 -0500 |
commit | bcccae4d7fd9c1a317b24e52a21ad0802548709b (patch) | |
tree | 5f5138db4a88c64d0ffe70704bcb080663475656 /requests_cache | |
parent | 82a9bd50cded0ef92e0e882ee4b63d1c4e9e590d (diff) | |
download | requests-cache-bcccae4d7fd9c1a317b24e52a21ad0802548709b.tar.gz |
Update docs
Diffstat (limited to 'requests_cache')
-rw-r--r-- | requests_cache/policy/actions.py | 2 | ||||
-rw-r--r-- | requests_cache/session.py | 13 |
2 files changed, 3 insertions, 12 deletions
diff --git a/requests_cache/policy/actions.py b/requests_cache/policy/actions.py index ba927b0..eec00dc 100644 --- a/requests_cache/policy/actions.py +++ b/requests_cache/policy/actions.py @@ -303,7 +303,7 @@ class CacheActions(RichMixin): def _log_vary_diff( headers_1: MutableMapping[str, str], headers_2: MutableMapping[str, str], vary: List[str] ): - """Log which specific headers specified by Vary did not match, debug purposes""" + """Log which specific headers specified by Vary did not match""" if logger.level > DEBUG: return headers_1 = normalize_headers(headers_1) diff --git a/requests_cache/session.py b/requests_cache/session.py index f3dec60..e58cc57 100644 --- a/requests_cache/session.py +++ b/requests_cache/session.py @@ -194,15 +194,6 @@ class CacheMixin(MIXIN_BASE): cached_response = self.cache.get_response(actions.cache_key) actions.update_from_cached_response(cached_response, self.cache.create_key, **kwargs) - # TODO: Does this fit better here, or in CacheActions? - # If response contains Vary, check that the specified request headers match - # if cached_response and cached_response.headers.get('Vary'): - # vary = cached_response.headers['Vary'] - # new_cache_key = self.cache.create_key(request, match_headers=vary) - # vary_cache_key = self.cache.create_key(cached_response.request, match_headers=vary) - # if new_cache_key != vary_cache_key: - # cached_response = None - # Handle missing and expired responses based on settings and headers if actions.error_504: response: AnyResponse = get_504_response(request) @@ -344,8 +335,8 @@ class CachedSession(CacheMixin, OriginalSession): allowable_methods: Cache only responses for one of these HTTP methods always_revalidate: Revalidate with the server for every request, even if the cached response is not expired - match_headers: Match request headers when reading from the cache; may be either ``True`` or - a list of specific headers to match + match_headers: Request headers to match, when `Vary` response header is not available. May + be a list of headers, or ``True`` to match all. ignored_parameters: Request paramters, headers, and/or JSON body params to exclude from both request matching and cached request data stale_if_error: Return a stale response if a new request raises an exception. Optionally |