diff options
| author | Jordan Cook <jordan.cook@pioneer.com> | 2022-04-08 18:38:46 -0500 |
|---|---|---|
| committer | Jordan Cook <jordan.cook@pioneer.com> | 2022-04-09 16:12:05 -0500 |
| commit | 5ff1e4dc240829b77e24fbf49091dc1c2d351401 (patch) | |
| tree | 8cd075c195869cdecba84975fc80eb8719343899 /requests_cache/backends | |
| parent | 1828411bba841be3d0fa6d978952a14f2f8f2400 (diff) | |
| download | requests-cache-5ff1e4dc240829b77e24fbf49091dc1c2d351401.tar.gz | |
Refactor refresh/revalidate behavior
* Rename two (unreleased) options to be more consistent with browser behavior:
* `revalidate()` -> `refresh()`
* `refresh()` -> `force_refresh()`
* Revert `RequestSettings` changes and use just kwargs instead for per-request settings
* Add full type hints back to extra kwargs for `CachedSession.send()`
* Fix a bug in which some kwargs specific to requests-cache could get passed to `requests.Session.send()`
* Use 'must-revalidate' as a temporary header for a user-requested refresh
* Refer to expiration value of 0 more accurately as 'expire immediately' rather than 'do not cache'
* It may potentially be saved and used with revalidation, depending on other headers/settings
* `DO_NOT_CACHE` now has a different value but same effect
* Refer to constants in docs instead of 0, -1, etc.
* Log more details about post-read and pre-cache checks
Diffstat (limited to 'requests_cache/backends')
| -rw-r--r-- | requests_cache/backends/base.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/requests_cache/backends/base.py b/requests_cache/backends/base.py index f85c175..472ba9f 100644 --- a/requests_cache/backends/base.py +++ b/requests_cache/backends/base.py @@ -4,12 +4,14 @@ :classes-only: :nosignatures: """ -import pickle +from __future__ import annotations + from abc import ABC from collections import UserDict from collections.abc import MutableMapping from datetime import datetime from logging import getLogger +from pickle import PickleError from typing import Iterable, Iterator, Optional, Tuple, Union from requests import PreparedRequest, Response @@ -21,7 +23,7 @@ from ..serializers import init_serializer from ..settings import DEFAULT_CACHE_NAME, CacheSettings # Specific exceptions that may be raised during deserialization -DESERIALIZE_ERRORS = (AttributeError, ImportError, TypeError, ValueError, pickle.PickleError) +DESERIALIZE_ERRORS = (AttributeError, ImportError, PickleError, TypeError, ValueError) ResponseOrKey = Union[CachedResponse, str] logger = getLogger(__name__) |
