fix(deps): update dependency requests-cache to v1 - autoclosed
This MR contains the following updates:
| Package | Change | Age | Confidence |
|---|---|---|---|
| requests-cache (changelog) |
>=0.9.8,<0.10.0 -> >=1.2.1,<1.3.0
|
Release Notes
requests-cache/requests-cache (requests-cache)
v1.2.1
- Fix
normalize_headersnot accepting header values in bytes - Fix inconsistency due to rounding in
CachedResponse.expires_unixproperty - Fix form boundary used for cached multipart requests to fully comply with RFC 2046
- Fix loading cached JSON content with
decode_content=Truewhen the root element is an empty list or object - Fix usage example with
responseslibrary to be compatible withrequests2.32
v1.2.0
- Drop support for python 3.7
- Remove methods deprecated in 1.0 from
CachedSessionandBaseCache
- Add support for
X-HTTP-Method-Overrideand other headers that can override request method
- Add
CachedSession.wrap()classmethod to add caching to an existingrequests.Sessionobject
- Add
vacuumparameter toSQLiteCache.delete()to optionally skip vacuuming after deletion (enabled by default to free up disk space) - Optimize
SQLiteCache.delete()when deleting a single key
- Add support for RFC 7159 JSON body with
decode_content=True(root element with any type) - Use timezone-aware UTC datetimes for all internal expiration values
- Add support for python 3.12
- Note: There is a known bug with multiprocess/multithreaded usage of the SQLite backend on python 3.12.
- Add support for cattrs 23.2
- Fix
IncompleteReaderror that could sometimes occur with streaming requests due to mismatch withContent-Lengthheader - Handle a corner case with streaming requests, conditional requests, and redirects
- When redacting ignored parameters from a cached response, keep the rest of the original URL and headers without normalizing
- Add
CachedHTTPResponse._request_urlproperty for compatibility with urllib3 - Fix form boundary used for cached multipart requests to comply with RFC 2046
- If an explicit CA bundle path is passed via
verifyparam, cache the response under the same key asverify=True - Handle JSON Content-Type charsets and MIME type variations (such as
application/vnd.api+json) during request normalization and serialization
1.1.1 (2023-11-18)
- Backport fix from 1.2: Add compatibility with cattrs 23.2
v1.1.1
- Backport fix from 1.2: Add compatibility with cattrs 23.2
v1.1.0
- Add support for regular expressions with
urls_expire_after
- Add
busy_timeoutargument (see SQLite docs for details) - In WAL journaling mode (
wal=True), default to 'normal' synchronous mode instead of 'full' - Fix potential
OperationalError: database is lockedin multithreaded SQLite usage during bulk delete operations - Fix deadlock in multithreaded SQLite usage if a thread encounters an error during COMMIT
- Fix loading cached JSON content with
decode_content=Truewhen the root element is a list - Fix
BaseCache.recreate_keys()to normalize response bodies withb'None' - Fix
BaseCache.contains()for multipart POST requests - Fix
CachedResponse.historynot being fully deserialized on python<=3.8 - Fix request matching with
Varyand redirects - Skip normalizing
CachedResponse.urlso it always matches the original request URL - Avoid unnecessary cache writes for revalidation requests if headers and expiration are unchanged
- Add compatibility with urllib3 2.0
1.0.1 (2023-03-24)
- Ignore
Cache-Control: must-revalidateandno-cacheresponse headers withcache_control=False
v1.0.1
- Ignore
Cache-Control: must-revalidateandno-cacheresponse headers withcache_control=False
v1.0.0
See all unreleased issues and MRs
- Add support for
Cache-Control: min-fresh - Add support for
Cache-Control: max-stale - Add support for
Cache-Control: only-if-cached - Add support for
Cache-Control: stale-if-error - Add support for
Cache-Control: stale-while-error - Add support for
Vary - Revalidate for
Cache-Control: no-cacherequest or response header - Revalidate for
Cache-Control: max-age=0, must-revalidateresponse headers - Add an attribute
CachedResponse.revalidatedto indicate if a cached response was revalidated for the current request
- All settings that affect cache behavior can now be accessed and modified via
CachedSession.settings - Add
always_revalidatesession setting to always revalidate before using a cached response (if a validator is available). - Add
only_if_cachedsession setting to return only cached results without sending real requests - Add
stale_while_revalidatesession setting to return a stale response initially, while a non-blocking request is sent to refresh the response - Make behavior for
stale_if_errorpartially consistent withCache-Control: stale-if-error: Add support for time values (int, timedelta, etc.) in addition toTrue/False
- Add
only_if_cachedoption toCachedSession.request()andsend()to return only cached results without sending real requests - Add
refreshoption toCachedSession.request()andsend()to revalidate with the server before using a cached response - Add
force_refreshoption toCachedSession.request()andsend()to awlays make and cache a new request regardless of existing cache contents - Make behavior for
expire_after=0consistent withCache-Control: max-age=0: if the response has a validator, save it to the cache but revalidate on use.- The constant
requests_cache.DO_NOT_CACHEmay be used to completely disable caching for a request
- The constant
-
DynamoDB:
- For better read performance and usage of read throughput:
- The cache key is now used as the partition key
- Redirects are now cached only in-memory and not persisted
- Cache size (
len()) now uses a fast table estimate instead of a full scan
- Store responses in plain (human-readable) document format instead of fully serialized binary
- Create default table in on-demand mode instead of provisioned
- Add optional integration with DynamoDB TTL to improve performance for removing expired responses
- This is enabled by default, but may be disabled
- Decode JSON and text response bodies so the saved response can be fully human-readable/editable.
May be disabled with
decode_content=False.
- For better read performance and usage of read throughput:
-
Filesystem:
- The default file format has been changed from pickle to JSON
- Decode JSON and text response bodies so the saved response can be fully human-readable/editable.
May be disabled with
decode_content=False.
-
MongoDB:
- Store responses in plain (human-readable) document format instead of fully serialized binary
- Add optional integration with MongoDB TTL to improve performance for removing expired responses
- Disabled by default. See 'Backends: MongoDB' docs for details.
- Decode JSON and text response bodies so the saved response can be fully human-readable/editable.
May be disabled with
decode_content=False.
-
Redis:
- Add
ttl_offsetargument to add a delay between cache expiration and deletion
- Add
-
SQLite:
- Improve performance for removing expired responses with
delete() - Improve performance (slightly) with a large number of threads and high request rate
- Add
count()method to count responses, with option to exclude expired responses (performs a fast indexed count instead of slower in-memory filtering) - Add
size()method to get estimated size of the database (including in-memory databases) - Add
sorted()method with sorting and other query options - Add
walparameter to enable write-ahead logging
- Improve performance for removing expired responses with
-
SQLite, Redis, MongoDB, and GridFS:
- Close open database connections when
CachedSessionis used as a contextmanager, or ifCachedSession.close()is called
- Close open database connections when
- Add serializer name to cache keys to avoid errors due to switching serializers
- Always skip both cache read and write for requests excluded by
allowable_methods(previously only skipped write) - Ignore and redact common authentication headers and request parameters by default. This provides
some default recommended values for
ignored_parameters, to avoid accidentally storing common credentials in the cache. This will have no effect ifignored_parametersis already set. - Support distinct matching for requests that differ only by a parameter in
ignored_parameters(e.g., for a request sent both with and without authentication) - Support distinct matching for requests that differ only by duplicate request params (e.g,
a=1vs?a=1&a=2)
- Add
expiredandinvalidarguments toBaseCache.delete()(to replaceremove_expired_responses()) - Add
urlsandrequestsarguments toBaseCache.delete()(to replacedelete_url()) - Add
older_thanargument toBaseCache.delete()to delete responses older than a given value - Add
requestsargument toBaseCache.delete()to delete responses matching the given requests - Add
BaseCache.contains()method to check for cached requests either by key or byrequests.Requestobject - Add
urlargument toBaseCache.contains()method (to replacehas_url()) - Add
BaseCache.filter()method to get responses from the cache with various filters - Add
BaseCache.reset_expiration()method to reset expiration for existing responses - Add
BaseCache.recreate_keys()method to recreate cache keys for all previously cached responses (e.g., to preserve cache data after an update that changes request matching behavior) - Update
BaseCache.urlsinto a method that takes optional filter params, and returns sorted unique URLs
- Add
OriginalResponsetype, which adds type hints torequests.Responseobjects for extra attributes added by requests-cache:cache_keycreated_atexpiresfrom_cacheis_expiredrevalidated
-
OriginalResponse.cache_keyandexpireswill be populated for any new response that was written to the cache - Add request wrapper methods with return type hints for all HTTP methods (
CachedSession.get(),head(), etc.) - Set
CachedResponse.cache_keyattribute for responses read from lower-level storage methods (items(),values(), etc.)
-
PyInstaller: Fix potential
AttributeErrordue to undetected imports when requests-cache is bundled in a PyInstaller package - requests-oauthlib: Add support for header values as bytes for compatibility with OAuth1 features
-
redis-py: Fix forwarding connection parameters passed to
RedisCachefor redis-py 4.2 and python <=3.8 -
pymongo: Fix forwarding connection parameters passed to
MongoCachefor pymongo 4.1 and python <=3.8 - cattrs: Add compatibility with cattrs 22.2
-
python:
- Add tests and support for python 3.11
- Add tests and support for pypy 3.9
- Fix usage of memory backend with
install_cache() - Fix an uncommon
OperationalError: database is lockedin SQLite backend - Fix issue on Windows with occasional missing
CachedResponse.created_attimestamp - Add
CachedRequest.path_urlproperty for compatibility withRequestEncodingMixin - Fix potential
AttributeErrordue to undetected imports when requests-cache is bundled in a PyInstaller package - Fix
AttributeErrorwhen attempting to unpickle aCachedSessionobject, and instead disable pickling by raising aNotImplementedError - Raise an error for invalid expiration string values (except for headers containing httpdates)
- Previously, this would be quietly ignored, and the response would be cached indefinitely
- Fix behavior for
stale_if_errorif an error response code is added toallowable_codes
- Replace
appdirswithplatformdirs
The following methods are deprecated, and will be removed in 1.2. The recommended replacements are listed below. If this causes problems for you, please open an issue to discuss.
-
CachedSession.remove_expired_responses():BaseCache.delete(expired=True) -
BaseCache.remove_expired_responses():BaseCache.delete(expired=True) -
BaseCache.delete_url():BaseCache.delete(urls=[...]) -
BaseCache.delete_urls():BaseCache.delete(urls=[...]) -
BaseCache.has_key():BaseCache.contains() -
BaseCache.has_url():BaseCache.contains(url=...) -
BaseCache.keys():BaseCache.responses.keys()(for all keys), orBaseCache.filter()(for filtering options) -
BaseCache.values():BaseCache.responses.values()(for all values), orBaseCache.filter()(for filtering options) -
BaseCache.response_count():len(BaseCache.responses)(for all responses), orBaseCache.filter()(for filtering options)
- After initialization, cache settings can only be accessed and modified via
CachedSession.settings. Previously, some settings could be modified by setting them on eitherCachedSessionorBaseCache. In some cases this could silently fail or otherwise have undefined behavior. -
BaseCache.urlshas been replaced with a method that returns a list of URLs. - DynamoDB table structure has changed. If you are using the DynamoDB backend, you will need to create a new table when upgrading to 1.0. See DynamoDB backend docs for more details.
Minor breaking changes:
The following changes only affect advanced or undocumented usage, and are not expected to impact most users:
- The arguments
match_headersandignored_parametersmust be passed toCachedSession. Previously, these could also be passed to aBaseCacheinstance. - The
CachedSessionbackendargument must be either an instance or string alias. Previously it would also accept a backend class. - All serializer-specific
BaseStoragesubclasses have been removed, and merged into their respective parent classes. This includesSQLitePickleDict,MongoPickleDict, andGridFSPickleDict.- All
BaseStoragesubclasses now have aserializerattribute, which will be unused if set toNone.
- All
- The
cache_controlmodule (added in0.7) has been split up into multiple modules in a newpolicysubpackage
0.9.8 (2023-01-13)
- Fix
DeprecationWarningraised byBaseCache.urls - Reword ambiguous log message for
BaseCache.delete
Backport fixes from 1.0:
- For custom serializers, handle using a cattrs converter that doesn't support
omit_if_default - Raise an error for invalid expiration string values (except for headers containing httpdates)
0.9.7 (2022-10-26)
Backport compatibility fixes from 1.0:
-
PyInstaller: Fix potential
AttributeErrordue to undetected imports when requests-cache is bundled in a PyInstaller package - requests-oauthlib: Add support for header values as bytes for compatibility with OAuth1 features
- cattrs: Add compatibility with cattrs 22.2
- python: Add tests to ensure compatibility with python 3.11
- Fix
AttributeErrorwhen attempting to unpickle aCachedSessionobject, and instead disable pickling by raising aNotImplementedError
Add the following for forwards-compatibility with 1.0:
-
DeprecationWarningsto give an earlier notice for methods deprecated (not removed) in 1.0 -
requests_cache.policysubpackage (will replacerequests_cache.cache_controlmodule) BaseCache.contains()BaseCache.delete()BaseCache.filter()CachedSession.settings
0.9.6 (2022-08-24)
Backport fixes from 1.0:
- Remove potentially problematic row count from
BaseCache.__str__() - Remove upper version constraints for all non-dev dependencies
- Make dependency specification consistent between PyPI and Conda-Forge packages
0.9.5 (2022-06-29)
Backport fixes from 1.0:
- Fix usage of memory backend with
install_cache() - Add
CachedRequest.path_urlproperty - Add compatibility with cattrs 22.1
0.9.4 (2022-04-22)
Backport fixes from 1.0:
- Fix forwarding connection parameters passed to
RedisCachefor redis-py 4.2 and python <=3.8 - Fix forwarding connection parameters passed to
MongoCachefor pymongo 4.1 and python <=3.8
0.9.3 (2022-02-22)
- Fix handling BSON serializer differences between pymongo's
bsonand standalonebsoncodec. - Handle
CorruptGridFileerror in GridFS backend - Fix cache path expansion for user directories (
~/...) for SQLite and filesystem backends - Fix request normalization for request body with a list as a JSON root
- Skip normalizing a JSON request body if it's excessively large (>10MB) due to performance impact
- Fix some thread safety issues:
- Fix race condition in SQLite backend with dropping and recreating tables in multiple threads
- Fix race condition in filesystem backend when one thread deletes a file after it's opened but before it is read by a different thread
- Fix multiple race conditions in GridFS backend
0.9.2 (2022-02-15)
- Fix serialization in filesystem backend with binary content that is also valid UTF-8
- Fix some regression bugs introduced in 0.9.0:
- Add support for
paramsas a positional argument toCachedSession.request() - Add support for disabling expiration for a single request with
CachedSession.request(..., expire_after=-1)
- Add support for
0.9.1 (2022-01-15)
- Add support for python 3.10.2 and 3.9.10 (regarding resolving
ForwardReftypes during deserialization) - Add support for key-only request parameters (regarding hashing request data for cache key creation)
- Reduce verbosity of log messages when encountering an invalid JSON request body
Configuration
-
If you want to rebase/retry this MR, check this box
This MR has been generated by Renovate Bot.