History¶
0.6.4 (2021-06-04)¶
Fix a bug in which
filter_fn()would get called onresponse.requestinstead ofresponse
0.6.3 (2021-04-21)¶
Fix false positive warning with
include_get_headersFix handling of
decode_contentparameter forCachedResponse.raw.read()Replace deprecated pymongo
Collection.count()withestimated_document_count()
0.6.2 (2021-04-14)¶
Explicitly include docs, tests, and examples in sdist
0.6.1 (2021-04-13)¶
Handle errors due to invalid responses in
BaseCache.urlsAdd recently renamed
BaseCache.remove_old_entries()back, as an alias with a DeprecationWarningMake parent dirs for new SQLite databases
Add
aws_access_key_idandaws_secret_access_keykwargs toDynamoDbDictUpdate
GridFSPickleDict.__delitem__to raise a KeyError for missing itemsDemote most
logging.infostatements to debug levelExclude test directory from
find_packages()Make integration tests easier to run and/or fail more quickly in environments where Docker isn’t available
0.6.0 (2021-04-09)¶
See all included issues and PRs
Thanks to Code Shelter and contributors for making this release possible!
Serialization¶
Note: Due to the following changes, responses cached with previous versions of requests-cache will be invalid. These old responses will be treated as expired, and will be refreshed the next time they are requested. They can also be manually converted or removed, if needed (see notes below).
Add example script to convert an existing cache from previous serialization format to new one
When running
remove_expired_responses(), also remove responses that are invalid due to updated serialization formatAdd
CachedResponseclass to wrap cachedrequests.Responseobjects, which makes additional cache information available to client codeAdd
CachedHTTPResponseclass to wrapurllib3.response.HTTPResponseobjects, available viaCachedResponse.rawRe-construct the raw response on demand to avoid storing extra data in the cache
Improve emulation of raw request behavior used for iteration, streaming requests, etc.
Add
BaseCache.urlsproperty to get all URLs persisted in the cacheAdd optional support for
itsdangerousfor more secure serialization
Cache Expiration¶
Cached responses are now stored with an absolute expiration time, so
CachedSession.expire_afterno longer applies retroactively. To revalidate previously cached items with a new expiration time, see below:Add support for overriding original expiration (i.e., revalidating) in
CachedSession.remove_expired_responses()Add support for setting expiration for individual requests
Add support for setting expiration based on URL glob patterns
Add support for setting expiration as a
datetimeAdd support for explicitly disabling expiration with
-1(SinceNonemay be ambiguous in some cases)
Backends¶
SQLite: Allow passing user paths (
~/path-to-cache) to database file withdb_pathparamSQLite: Add
timeoutparameterMake default table names consistent across backends (
'http_cache')
Bugfixes¶
Fix caching requests with data specified in
jsonparameterFix caching requests with
verifyparameterFix duplicate cached responses due to some unhandled variations in URL format
To support this, the
url-normalizelibrary has been added to dependencies
Fix usage of backend-specific params when used in place of
cache_nameFix potential TypeError with
DbPickleDictinitializationFix usage of
CachedSession.cache_disabledif used within another contextmanagerFix non-thread-safe iteration in
BaseCacheFix
get_cache(),clear(), andremove_expired_responses()so they will do nothing if requests-cache is not installedUpdate usage of deprecated MongoClient
save()methodReplace some old bugs with new and different bugs, just to keep life interesting
General¶
Drop support for python <= 3.5
Add
CacheMixinclass to make the features ofCachedSessionusable as a mixin class, for compatibility with other requests-based libraries.Add
HEADto defaultallowable_methods
Docs & Tests¶
Add type annotations to main functions/methods in public API, and include in documentation on readthedocs
Add Contributing Guide, Security info, and more examples & detailed usage info in User Guide and Advanced Usage sections.
Increase test coverage and rewrite most tests using pytest
Add containerized backends for both local and CI integration testing
0.5.2 (2019-08-14)¶
Fix DeprecationWarning from collections #140
0.5.1 (2019-08-13)¶
Remove Python 2.6 Testing from travis #133
Fix DeprecationWarning from collections #131
vacuum the sqlite database after clearing a table #134
Fix handling of unpickle errors #128
0.5.0 (2019-04-18)¶
Project is now added to Code Shelter
Add gridfs support, thanks to @chengguangnan
Add dynamodb support, thanks to @ar90n
Add response filter #104, thanks to @christopher-dG
Fix bulk_commit #78
Fix remove_expired_responses missed in init.py #93
Fix deprecation warnings #122, thanks to mbarkhau
0.4.13 (2016-12-23)¶
Support PyMongo3, thanks to @craigls #72
Fix streaming releate issue #68
0.4.12 (2016-03-19)¶
Fix ability to pass backend instance in
install_cache#61
0.4.11 (2016-03-07)¶
ignore_parametersfeature, thanks to @themiurgo and @YetAnotherNerd (#52, #55)More informative message for missing backend dependencies, thanks to @Garrett-R (#60)
0.4.10 (2015-04-28)¶
Better transactional handling in sqlite #50, thanks to @rgant
Compatibility with streaming in requests >= 2.6.x
0.4.9 (2015-01-17)¶
expire_afternow also acceptstimedelta, thanks to @femtotraderAdded Ability to include headers to cache key (
include_get_headersoption)Added string representation for
CachedSession
0.4.8 (2014-12-13)¶
Fix bug in reading cached streaming response
0.4.7 (2014-12-06)¶
Fix compatibility with Requests > 2.4.1 (json arg, response history)
0.4.6 (2014-10-13)¶
Monkey patch now uses class instead lambda (compatibility with rauth)
Normalize (sort) parameters passed as builtin dict
0.4.5 (2014-08-22)¶
Requests==2.3.0 compatibility, thanks to @gwillem
0.4.4 (2013-10-31)¶
Check for backend availability in install_cache(), not at the first request
Default storage fallbacks to memory if
sqliteis not available
0.4.3 (2013-09-12)¶
Fix
response.from_cachenot set in hooks
0.4.2 (2013-08-25)¶
Fix
UnpickleableErrorfor gzip responses
0.4.1 (2013-08-19)¶
requests_cache.enabled()context managerCompatibility with Requests 1.2.3 cookies handling
0.4.0 (2013-04-25)¶
Redis backend. Thanks to @michaelbeaumont
Fix for changes in Requests 1.2.0 hooks dispatching
0.3.0 (2013-02-24)¶
Support for
Requests1.x.xCachedSessionMany backward incompatible changes
0.2.1 (2013-01-13)¶
Fix broken PyPi package
0.2.0 (2013-01-12)¶
Last backward compatible version for
Requests0.14.2
0.1.3 (2012-05-04)¶
Thread safety for default
sqlitebackendTake into account the POST parameters when cache is configured with ‘POST’ in
allowable_methods
0.1.2 (2012-05-02)¶
Reduce number of
sqlitedatabase write operationsfast_saveoption forsqlitebackend