diff options
author | Jordan Cook <jordan.cook@pioneer.com> | 2022-03-19 16:49:27 -0500 |
---|---|---|
committer | Jordan Cook <jordan.cook@pioneer.com> | 2022-03-29 12:17:43 -0500 |
commit | 2578cde2692714f1d74fcc20b47fd68d81295b51 (patch) | |
tree | ca2b41d3c171394eac0cf2ea009d19182193c9ce /requests_cache/session.py | |
parent | b3646b03bc05f5b05f4384eb9a2b4796fa59cb34 (diff) | |
download | requests-cache-2578cde2692714f1d74fcc20b47fd68d81295b51.tar.gz |
Fix some regression bugs and broken tests
Diffstat (limited to 'requests_cache/session.py')
-rw-r--r-- | requests_cache/session.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/requests_cache/session.py b/requests_cache/session.py index b957124..8341b97 100644 --- a/requests_cache/session.py +++ b/requests_cache/session.py @@ -139,17 +139,15 @@ class CacheMixin(MIXIN_BASE): cached_response: Optional[CachedResponse] = None if not actions.skip_read: cached_response = self.cache.get_response(actions.cache_key) - actions.update_from_cached_response(cached_response) + actions.update_from_cached_response(cached_response) # Handle missing and expired responses based on settings and headers - if actions.send_request: - response: AnyResponse = self._send_and_cache( - request, actions, cached_response, **kwargs - ) + if actions.error_504: + response: AnyResponse = get_504_response(request) + elif actions.send_request: + response = self._send_and_cache(request, actions, cached_response, **kwargs) elif actions.resend_request: response = self._resend(request, actions, cached_response, **kwargs) # type: ignore - elif actions.error_504: - response = get_504_response(request) else: response = cached_response # type: ignore # Guaranteed to be non-None by this point @@ -260,7 +258,7 @@ class CacheMixin(MIXIN_BASE): self.cache.remove_expired_responses(expire_after) def __repr__(self): - return f'<CachedSession(cache={self.cache}, settings={self.settings})>' + return f'<CachedSession(cache={repr(self.cache)}, settings={self.settings})>' class CachedSession(CacheMixin, OriginalSession): |