Update dependency requests_cache to v1 #173
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
==0.6.4
->==1.2.1
Warning
Some dependencies could not be looked up. Check the Dependency Dashboard for more information.
Release Notes
requests-cache/requests-cache (requests_cache)
v1.2.1
Compare Source
🪲 Bugfixes:
normalize_headers
not accepting header values in bytesCachedResponse.expires_unix
propertydecode_content=True
when the root element is an empty list or objectresponses
library to be compatible withrequests
2.32v1.2.0
Compare Source
CachedSession
andBaseCache
🕗 Expiration & headers:
X-HTTP-Method-Override
and other headers that can override request method⚙️ Session methods:
CachedSession.wrap()
classmethod to add caching to an existingrequests.Session
object💾 SQLite Backend:
vacuum
parameter toSQLiteCache.delete()
to optionally skip vacuuming after deletion (enabled by default to free up disk space)SQLiteCache.delete()
when deleting a single key🧩 Compatibility:
decode_content=True
(root element with any type)🪲 Bugfixes:
IncompleteRead
error that could sometimes occur with streaming requests due to mismatch withContent-Length
headerCachedHTTPResponse._request_url
property for compatibility with urllib3verify
param, cache the response under the same key asverify=True
application/vnd.api+json
) during request normalization and serialization1.1.1 (2023-11-18)
v1.1.1
Compare Source
v1.1.0
Compare Source
⚙️ Session settings:
urls_expire_after
💾 SQLite Backend:
busy_timeout
argument (see SQLite docs for details)wal=True
), default to 'normal' synchronous mode instead of 'full'OperationalError: database is locked
in multithreaded SQLite usage during bulk delete operations🪲 Bugfixes:
decode_content=True
when the root element is a listBaseCache.recreate_keys()
to normalize response bodies withb'None'
BaseCache.contains()
for multipart POST requestsCachedResponse.history
not being fully deserialized on python<=3.8Vary
and redirectsCachedResponse.url
so it always matches the original request URL1.0.1 (2023-03-24)
Cache-Control: must-revalidate
andno-cache
response headers withcache_control=False
v1.0.1
Compare Source
Cache-Control: must-revalidate
andno-cache
response headers withcache_control=False
v1.0.0
Compare Source
See all unreleased issues and PRs
🕗 Expiration & headers:
Cache-Control: min-fresh
Cache-Control: max-stale
Cache-Control: only-if-cached
Cache-Control: stale-if-error
Cache-Control: stale-while-error
Vary
Cache-Control: no-cache
request or response headerCache-Control: max-age=0, must-revalidate
response headersCachedResponse.revalidated
to indicate if a cached response was revalidated forthe current request
⚙️ Session settings:
CachedSession.settings
always_revalidate
session setting to always revalidate before using a cached response (if a validator is available).only_if_cached
session setting to return only cached results without sending real requestsstale_while_revalidate
session setting to return a stale response initially, while a non-blocking request is sent to refresh the responsestale_if_error
partially consistent withCache-Control: stale-if-error
: Add support for time values (int, timedelta, etc.) in addition toTrue/False
⚙️ Request settings:
only_if_cached
option toCachedSession.request()
andsend()
to return only cached results without sending real requestsrefresh
option toCachedSession.request()
andsend()
to revalidate with the server before using a cached responseforce_refresh
option toCachedSession.request()
andsend()
to awlays make and cache a new request regardless of existing cache contentsexpire_after=0
consistent withCache-Control: max-age=0
: if the response has a validator, save it to the cache but revalidate on use.requests_cache.DO_NOT_CACHE
may be used to completely disable caching for a request💾 Backends:
len()
) now uses a fast table estimate instead of a full scanMay be disabled with
decode_content=False
.May be disabled with
decode_content=False
.May be disabled with
decode_content=False
.ttl_offset
argument to add a delay between cache expiration and deletiondelete()
count()
method to count responses, with option to exclude expired responses (performs a fast indexed count instead of slower in-memory filtering)size()
method to get estimated size of the database (including in-memory databases)sorted()
method with sorting and other query optionswal
parameter to enable write-ahead loggingCachedSession
is used as a contextmanager, or ifCachedSession.close()
is calledallowable_methods
(previously only skipped write)some default recommended values for
ignored_parameters
, to avoid accidentally storing commoncredentials in the cache. This will have no effect if
ignored_parameters
is already set.ignored_parameters
(e.g., for a request sent both with and without authentication)
a=1
vs?a=1&a=2
)ℹ️ Convenience methods:
expired
andinvalid
arguments toBaseCache.delete()
(to replaceremove_expired_responses()
)urls
andrequests
arguments toBaseCache.delete()
(to replacedelete_url()
)older_than
argument toBaseCache.delete()
to delete responses older than a given valuerequests
argument toBaseCache.delete()
to delete responses matching the given requestsBaseCache.contains()
method to check for cached requests either by key or byrequests.Request
objecturl
argument toBaseCache.contains()
method (to replacehas_url()
)BaseCache.filter()
method to get responses from the cache with various filtersBaseCache.reset_expiration()
method to reset expiration for existing responsesBaseCache.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)
BaseCache.urls
into a method that takes optional filter params, and returns sorted unique URLsℹ️ Response attributes and type hints:
OriginalResponse
type, which adds type hints torequests.Response
objects for extra attributes added by requests-cache:cache_key
created_at
expires
from_cache
is_expired
revalidated
OriginalResponse.cache_key
andexpires
will be populated for any new response that was written to the cacheCachedSession.get()
,head()
, etc.)CachedResponse.cache_key
attribute for responses read from lower-level storage methods(
items()
,values()
, etc.)🧩 Compatibility fixes:
AttributeError
due to undetected imports when requests-cache is bundled in a PyInstaller packageRedisCache
for redis-py 4.2 and python <=3.8MongoCache
for pymongo 4.1 and python <=3.8🪲 Bugfixes:
install_cache()
OperationalError: database is locked
in SQLite backendCachedResponse.created_at
timestampCachedRequest.path_url
property for compatibility withRequestEncodingMixin
AttributeError
due to undetected imports when requests-cache is bundled in a PyInstaller packageAttributeError
when attempting to unpickle aCachedSession
object, and instead disable pickling by raising aNotImplementedError
stale_if_error
if an error response code is added toallowable_codes
📦 Dependencies:
appdirs
withplatformdirs
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)CachedSession.settings
. Previously, some settings could be modified by setting them on eitherCachedSession
orBaseCache
. In some cases this could silently fail or otherwise have undefined behavior.BaseCache.urls
has been replaced with a method that returns a list of URLs.Minor breaking changes:
The following changes only affect advanced or undocumented usage, and are not expected to impact most users:
match_headers
andignored_parameters
must be passed toCachedSession
. Previously, these could also be passed to aBaseCache
instance.CachedSession
backend
argument must be either an instance or string alias. Previously it would also accept a backend class.BaseStorage
subclasses have been removed, and merged into their respective parent classes. This includesSQLitePickleDict
,MongoPickleDict
, andGridFSPickleDict
.BaseStorage
subclasses now have aserializer
attribute, which will be unused if set toNone
.cache_control
module (added in0.7
) has been split up into multiple modules in a newpolicy
subpackage0.9.8 (2023-01-13)
DeprecationWarning
raised byBaseCache.urls
BaseCache.delete
Backport fixes from 1.0:
omit_if_default
0.9.7 (2022-10-26)
Backport compatibility fixes from 1.0:
AttributeError
due to undetected imports when requests-cache is bundled in a PyInstaller packageAttributeError
when attempting to unpickle aCachedSession
object, and instead disable pickling by raising aNotImplementedError
Add the following for forwards-compatibility with 1.0:
DeprecationWarnings
to give an earlier notice for methods deprecated (not removed) in 1.0requests_cache.policy
subpackage (will replacerequests_cache.cache_control
module)BaseCache.contains()
BaseCache.delete()
BaseCache.filter()
CachedSession.settings
0.9.6 (2022-08-24)
Backport fixes from 1.0:
BaseCache.__str__()
0.9.5 (2022-06-29)
Backport fixes from 1.0:
install_cache()
CachedRequest.path_url
property0.9.4 (2022-04-22)
Backport fixes from 1.0:
RedisCache
for redis-py 4.2 and python <=3.8MongoCache
for pymongo 4.1 and python <=3.80.9.3 (2022-02-22)
bson
and standalonebson
codec.CorruptGridFile
error in GridFS backend~/...
) for SQLite and filesystem backendsbefore it is read by a different thread
0.9.2 (2022-02-15)
params
as a positional argument toCachedSession.request()
CachedSession.request(..., expire_after=-1)
0.9.1 (2022-01-15)
ForwardRef
types during deserialization)v0.9.8
Compare Source
DeprecationWarning
raised byBaseCache.urls
BaseCache.delete
Backport fixes from 1.0:
omit_if_default
v0.9.7
Compare Source
Backport compatibility fixes from 1.0:
AttributeError
due to undetected imports when requests-cache is bundled in a PyInstaller packageAttributeError
when attempting to unpickle aCachedSession
object, and instead disable pickling by raising aNotImplementedError
Add the following for forwards-compatibility with 1.0:
DeprecationWarnings
to give an earlier notice for methods deprecated (not removed) in 1.0requests_cache.policy
subpackage (will replacerequests_cache.cache_control
module)BaseCache.contains()
BaseCache.delete()
BaseCache.filter()
CachedSession.settings
v0.9.6
Compare Source
Backport fixes from 1.0:
BaseCache.__str__()
v0.9.5
Compare Source
Backport fixes from 1.0:
install_cache()
CachedRequest.path_url
propertyv0.9.4
Compare Source
Backport fixes from 1.0:
RedisCache
for redis-py 4.2 and python <=3.8MongoCache
for pymongo 4.1 and python <=3.8v0.9.3
Compare Source
bson
and standalonebson
codec.CorruptGridFile
error in GridFS backend~/...
) for SQLite and filesystem backendsbefore it is read by a different thread
v0.9.2
Compare Source
params
as a positional argument toCachedSession.request()
CachedSession.request(..., expire_after=-1)
v0.9.1
Compare Source
ForwardRef
types during deserialization)v0.9.0
Compare Source
See all issues and PRs for 0.9
🕗 Expiration & headers:
Cache-Control
request headers by defaultCache-Control: immutable
Cache-Control: max-age=0
andExpires: 0
304 Not Modified
response is receivedexpire_after
param forCachedSession.send()
💾 Backends:
🚀 Performance:
CachedSession.request()
andCachedSession.send()
🪲 Bugfixes:
BaseCache
keyword arguments passed along with a backend instancecache_control=True
is used with anexpire_after
valueCachedResponse
serialization behavior when using stdlibpickle
in a custom serializer0.8.1 (2021-09-15)
ignored_parameters
fromCachedResponse.url
(if used for credentials or other sensitive info)DbDict
, etc. so fully qualified imports don't breakv0.8.1
Compare Source
ignored_parameters
fromCachedResponse.url
(if used for credentials or other sensitive info)DbDict
, etc. so fully qualified imports don't breakv0.8.0
Compare Source
See all issues and PRs for 0.8
🕗 Expiration & headers:
ETag
+If-None-Match
headersLast-Modified
+If-Modified-Since
headers304 Not Modified
responses💾 Backends:
FileCache.cache_dir
wrapper propertyFileCache.paths()
methoduse_cache_dir
option to use platform-specific user cache directorypathlib.Path
objects for all file pathsSQLiteCache.db_path
wrapper propertyuse_memory
option and support for in-memory databasesuse_cache_dir
option to use platform-specific user cache directorypathlib.Path
objects for all file paths🚀 Performance:
cattrs
by default for optimized serializationcreate_key()
to optionally accept parameters forrequests.Request
instead of a request objectmatch_headers
to optionally accept a list of specific headers to matchkey_fn
parameterℹ️ Cache convenience methods:
BaseCache.update()
method as a shortcut for exporting to a different cache instanceBaseCache.has_url()
anddelete_url()
to optionally take parameters forrequests.Request
instead of just a URL📦 Dependencies:
appdirs
as a dependency for easier cross-platform usage of user cache directoriescattrs
from optional to required dependencyitsdangerous
from required to optional (but recommended) dependencyrequests
2.22+ andurllib3
1.25.5+The following changes are meant to make certain behaviors more obvious for new users, without breaking existing usage:
Cache-Control: stale-if-error
, renameold_data_on_error
tostale_if_error
include_get_headers
tomatch_headers
backends.sqlite.Db*
->SQLiteCache
,SQLiteDict
,SQLitePickleDict
core
moduleBaseCache.remove_old_entries()
method0.7.5 (2021-09-15)
redirects.sqlite
when using filesystem backendredirects.sqlite
would get included in response paths with filesystem backend0.7.4 (2021-08-16)
Expires
headers not getting converted to UTC0.7.3 (2021-08-10)
DbCache.clear()
to succeed even if the database is corruptedDbDict.bulk_delete()
to split the operation into multiple statements to support deleting more items than SQLite's variable limit (999).json
,.yaml
,.pkl
, etc.) by default; can be overridden or disabled with theextension
parameter.BaseCache.delete_urls()
method to bulk delete multiple responses from the cache based onrequest URL
0.7.2 (2021-07-21)
Response.next
(to get the next request in a redirect chain) when 302 responses are cached directlyCachedResponse.cache_key
attributeCachedResponse
a non-slotted class to allow client code to set arbitrary attributes on it0.7.1 (2021-07-09)
v0.7.5
Compare Source
redirects.sqlite
when using filesystem backendredirects.sqlite
would get included in response paths with filesystem backendv0.7.4
Compare Source
Expires
headers not getting converted to UTCv0.7.3
Compare Source
DbCache.clear()
to succeed even if the database is corruptedDbDict.bulk_delete()
to split the operation into multiple statements to support deleting more items than SQLite's variable limit (999).json
,.yaml
,.pkl
, etc.) by default; can be overridden or disabled with theextension
parameter.BaseCache.delete_urls()
method to bulk delete multiple responses from the cache based onrequest URL
v0.7.2
Compare Source
Response.next
(to get the next request in a redirect chain) when 302 responses are cached directlyCachedResponse.cache_key
attributeCachedResponse
a non-slotted class to allow client code to set arbitrary attributes on itv0.7.1
Compare Source
v0.7.0
Compare Source
See all issues and PRs for 0.7
🕗 Expiration & headers:
Cache-Control: max-age
Cache-Control: no-cache
Cache-Control: no-store
Cache-Control: max-age
Cache-Control: no-store
Expires
cache_control
option toCachedSession
to enable setting expiration with cache headersexpire_after
parametersexpire_after=0
💾 Backends:
DynamoDbDict.__iter__
to return keys instead of valuesboto3.resource
Collection.find_and_modify()
pymongo.MongoClient
redis.Redis
use_temp
option to store files in a temp directorysqlite3.connect
💾 Serialization:
cattrs
ultrajson
ignored_parameters
to also exclude ignored request params, body params, or headers from cached response data (to avoid storing API keys or other credentials)old_data_on_error
option to also handle error response codesold_data_on_error
is setℹ️ Convenience methods:
BaseCache.save_response()
BaseCache.keys()
andvalues()
methodsBaseCache.response_count()
method to get an accurate count of responses (excluding invalid and expired)str(CachedResponse)
CachedSession
,CachedResponse
, andBaseCache
BaseCache.urls
to only skip invalid responses, not delete them (for better performance)📦 Dependencies:
requests
version of2.17
attrs
as a dependency for improved serialization modelscattrs
as an optional dependencypip install
):requests-cache[all]
(to install everything)requests-cache[bson]
requests-cache[json]
requests-cache[dynamodb]
requests-cache[mongodb]
requests-cache[redis]
📦 Compatibility and packaging:
requests 2.17
and2.18
requests
0.6.4 (2021-06-04)
filter_fn()
would get called onresponse.request
instead ofresponse
0.6.3 (2021-04-21)
include_get_headers
decode_content
parameter forCachedResponse.raw.read()
Collection.count()
withestimated_document_count()
0.6.2 (2021-04-14)
0.6.1 (2021-04-13)
BaseCache.urls
BaseCache.remove_old_entries()
back, as an alias with a DeprecationWarningaws_access_key_id
andaws_secret_access_key
kwargs toDynamoDbDict
GridFSPickleDict.__delitem__
to raise a KeyError for missing itemslogging.info
statements to debug levelfind_packages()
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.