Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-requests-cache for 
openSUSE:Factory checked in at 2021-04-24 23:09:23
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-requests-cache (Old)
 and      /work/SRC/openSUSE:Factory/.python-requests-cache.new.12324 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-requests-cache"

Sat Apr 24 23:09:23 2021 rev:6 rq:888211 version:0.6.3

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-requests-cache/python-requests-cache.changes  
    2021-04-17 23:24:40.925565109 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-requests-cache.new.12324/python-requests-cache.changes
   2021-04-24 23:10:34.455515383 +0200
@@ -1,0 +2,10 @@
+Sat Apr 24 11:30:00 UTC 2021 - John Vandenberg <[email protected]>
+
+- Update to v0.6.3
+  * Fix false positive warning with `include_get_headers`
+  * Fix handling of `decode_content` parameter for
+    `CachedResponse.raw.read()`
+  * Replace deprecated pymongo `Collection.count()` with
+    `estimated_document_count()`
+
+-------------------------------------------------------------------

Old:
----
  requests-cache-0.6.2.tar.gz

New:
----
  requests-cache-0.6.3.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-requests-cache.spec ++++++
--- /var/tmp/diff_new_pack.AseMU7/_old  2021-04-24 23:10:34.947516079 +0200
+++ /var/tmp/diff_new_pack.AseMU7/_new  2021-04-24 23:10:34.951516084 +0200
@@ -18,7 +18,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-requests-cache
-Version:        0.6.2
+Version:        0.6.3
 Release:        0
 Summary:        Persistent cache for requests library
 License:        BSD-2-Clause

++++++ requests-cache-0.6.2.tar.gz -> requests-cache-0.6.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/requests-cache-0.6.2/CONTRIBUTING.md 
new/requests-cache-0.6.3/CONTRIBUTING.md
--- old/requests-cache-0.6.2/CONTRIBUTING.md    2021-04-14 17:42:10.000000000 
+0200
+++ new/requests-cache-0.6.3/CONTRIBUTING.md    2021-04-21 17:51:30.000000000 
+0200
@@ -44,8 +44,8 @@
 
 ### Test Layout
 * Tests are divided into unit and integration tests:
-    * Unit tests can be run without any additional setup, and don't depend on 
any external services
-    * Integration tests depend on additional services, which are easiest to 
run using Docker
+    * Unit tests can be run without any additional setup, and **don't depend 
on any external services**.
+    * Integration tests **depend on additional services**, which are easiest 
to run using Docker
       (see Integration Tests section below).
 * See 
[conftest.py](https://github.com/reclosedev/requests-cache/blob/master/tests/conftest.py)
 for
   [pytest fixtures](https://docs.pytest.org/en/stable/fixture.html) that apply 
the most common
@@ -83,16 +83,6 @@
 For backend databases, you can install and run them on the host instead of in 
a container, as long
 as they are running on the default port.
 
-## Debugging
-When you run into issues while working on new features and/or tests, it will 
make your life much easier
-to use a debugger instead of `print` statements. Most IDEs have a built-in 
debugger, but if
-you prefer the command line, [ipdb](https://github.com/gotcha/ipdb) is a good 
option. To install:
-```bash
-pip install ipython ipdb
-```
-
-The `runtests.sh` script will use ipdb by default, if it's installed.
-
 ## Documentation
 [Sphinx](http://www.sphinx-doc.org/en/master/) is used to generate 
documentation.
 
@@ -145,3 +135,12 @@
 - Push a new tag, e.g.: `git tag v0.1 && git push origin --tags`
 - This will trigger a deployment. Verify that this completes successfully and 
that the new version
   can be installed from pypi with `pip install`
+
+## Pre-Releases
+Pre-release builds are convenient for letting testers try out in-development 
changes. Versions with
+the suffix `.dev` (among others) can be deployed to PyPI and installed by 
users with `pip install --pre`,
+and are otherwise ignored by `pip install`. See python packaging docs on
+[pre-release 
versioning](https://packaging.python.org/guides/distributing-packages-using-setuptools/#pre-release-versioning)
+for more details.
+
+A pre-release build for requests-cache will automatically be published for 
**any commits to the dev branch.**
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/requests-cache-0.6.2/CONTRIBUTORS.md 
new/requests-cache-0.6.3/CONTRIBUTORS.md
--- old/requests-cache-0.6.2/CONTRIBUTORS.md    2021-04-14 17:42:10.000000000 
+0200
+++ new/requests-cache-0.6.3/CONTRIBUTORS.md    2021-04-21 17:51:30.000000000 
+0200
@@ -1,5 +1,6 @@
 # Contributors
-Thanks to the following people for contributing patches and suggestions:
+Thanks to the following individuals for providing pull requests, feedback, and 
other
+contributions that have helped to improve requests-cache:
 
 * [Aaron-mf1](https://github.com/aaron-mf1)
 * [Alex Morega](https://github.com/mgax)
@@ -20,13 +21,14 @@
 * [Guangnan Cheng](https://github.com/chengguangnan)
 * [Honza Javorek](https://github.com/honzajavorek)
 * [Ilya](https://github.com/libbkmz)
-* [J Rob Gant ](https://github.com/rgant)
+* [J Rob Gant](https://github.com/rgant)
 * [Jace Browning](https://github.com/jacebrowning)
-* [Jessy Williams ](https://github.com/jkwill87)
+* [Jessy Williams](https://github.com/jkwill87)
 * [John Vandenberg](https://github.com/jayvdb)
 * [J??rgen Hermann](https://github.com/jhermann)
 * [Kieran W](https://github.com/FredHappyface)
 * [Kristian Kvilekval](https://github.com/kgk)
+* [M Hellmund](https://github.com/MHellmund)
 * [MBarkhau](https://github.com/mbarkhau)
 * [Marc Abramowitz](https://github.com/msabramo)
 * [Marius Gedminas](https://github.com/mgedmin)
@@ -42,6 +44,7 @@
 * [Paul Furley](https://github.com/paulfurley)
 * [Philipp A.](https://github.com/flying-sheep)
 * [Sebastian H??ffner](https://github.com/shoeffner)
+* [Shiftinv](https://github.com/shiftinv)
 * [Simon Biewald](https://github.com/Varbin)
 * [Slin Lee](https://github.com/slinlee)
 * [Stavros Korokithakis](https://github.com/skorokithakis)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/requests-cache-0.6.2/HISTORY.md 
new/requests-cache-0.6.3/HISTORY.md
--- old/requests-cache-0.6.2/HISTORY.md 2021-04-14 17:42:10.000000000 +0200
+++ new/requests-cache-0.6.3/HISTORY.md 2021-04-21 17:51:30.000000000 +0200
@@ -1,5 +1,10 @@
 # History
 
+### 0.6.3 (2021-TBD)
+* Fix false positive warning with `include_get_headers`
+* Fix handling of `decode_content` parameter for `CachedResponse.raw.read()`
+* Replace deprecated pymongo `Collection.count()` with 
`estimated_document_count()`
+
 ### 0.6.2 (2021-04-14)
 * Explicitly include docs, tests, and examples in sdist
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/requests-cache-0.6.2/PKG-INFO 
new/requests-cache-0.6.3/PKG-INFO
--- old/requests-cache-0.6.2/PKG-INFO   2021-04-14 17:42:23.843275800 +0200
+++ new/requests-cache-0.6.3/PKG-INFO   2021-04-21 17:51:49.601324600 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: requests-cache
-Version: 0.6.2
+Version: 0.6.3
 Summary: Persistent cache for requests library
 Home-page: https://github.com/reclosedev/requests-cache
 Author: Roman Haritonov
@@ -86,6 +86,11 @@
         
         # History
         
+        ### 0.6.3 (2021-TBD)
+        * Fix false positive warning with `include_get_headers`
+        * Fix handling of `decode_content` parameter for 
`CachedResponse.raw.read()`
+        * Replace deprecated pymongo `Collection.count()` with 
`estimated_document_count()`
+        
         ### 0.6.2 (2021-04-14)
         * Explicitly include docs, tests, and examples in sdist
         
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/requests-cache-0.6.2/docs/_static/collapsible_container.css 
new/requests-cache-0.6.3/docs/_static/collapsible_container.css
--- old/requests-cache-0.6.2/docs/_static/collapsible_container.css     
1970-01-01 01:00:00.000000000 +0100
+++ new/requests-cache-0.6.3/docs/_static/collapsible_container.css     
2021-04-21 17:51:30.000000000 +0200
@@ -0,0 +1,26 @@
+/* Taken from: 
https://github.com/plone/training/blob/master/_static/custom.css */
+
+.toggle {
+    background: none repeat scroll 0 0 #e7f2fa;
+    padding: 12px;
+    line-height: 24px;
+    margin-bottom: 24px;
+}
+
+.toggle .admonition-title {
+    display: block;
+    clear: both;
+    cursor: pointer;
+}
+
+.toggle .admonition-title:after {
+    content: " ???";
+}
+
+.toggle .admonition-title.open:after {
+    content: " ???";
+}
+
+.toggle p:last-child {
+    margin-bottom: 0;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/requests-cache-0.6.2/docs/_templates/page.html 
new/requests-cache-0.6.3/docs/_templates/page.html
--- old/requests-cache-0.6.2/docs/_templates/page.html  1970-01-01 
01:00:00.000000000 +0100
+++ new/requests-cache-0.6.3/docs/_templates/page.html  2021-04-21 
17:51:30.000000000 +0200
@@ -0,0 +1,15 @@
+{# Taken from: 
https://github.com/plone/training/blob/master/_templates/page.html #}
+{% extends "!page.html" %}
+
+{% block footer %}
+ <script type="text/javascript">
+    $(document).ready(function() {
+        $(".toggle > *").hide();
+        $(".toggle .admonition-title").show();
+        $(".toggle .admonition-title").click(function() {
+            $(this).parent().children().not(".admonition-title").toggle(400);
+            $(this).parent().children(".admonition-title").toggleClass("open");
+        })
+    });
+</script>
+{% endblock %}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/requests-cache-0.6.2/docs/conf.py 
new/requests-cache-0.6.3/docs/conf.py
--- old/requests-cache-0.6.2/docs/conf.py       2021-04-14 17:42:10.000000000 
+0200
+++ new/requests-cache-0.6.3/docs/conf.py       2021-04-21 17:51:30.000000000 
+0200
@@ -65,3 +65,8 @@
 # HTML theme settings
 pygments_style = 'sphinx'
 html_theme = 'sphinx_rtd_theme'
+
+
+def setup(app):
+    """Run some additional steps after the Sphinx builder is initialized"""
+    app.add_css_file('collapsible_container.css')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/requests-cache-0.6.2/docs/examples.rst 
new/requests-cache-0.6.3/docs/examples.rst
--- old/requests-cache-0.6.2/docs/examples.rst  1970-01-01 01:00:00.000000000 
+0100
+++ new/requests-cache-0.6.3/docs/examples.rst  2021-04-21 17:51:30.000000000 
+0200
@@ -0,0 +1,73 @@
+Examples
+--------
+This section contains some complete examples that demonstrate the main 
features of requests-cache.
+
+These can also be found in the
+`examples/ 
<https://github.com/reclosedev/requests-cache/tree/master/examples>`_ folder on 
GitHub.
+
+
+Basic usage (with sessions)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.. include:: ../examples/log_requests.py
+    :start-line: 2
+    :end-line: 3
+
+.. admonition:: Example code
+    :class: toggle
+
+    .. literalinclude:: ../examples/basic_usage.py
+        :lines: 1,6-
+
+
+Basic usage (with patching)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.. include:: ../examples/session_patch.py
+    :start-line: 3
+    :end-line: 4
+
+.. admonition:: Example code
+    :class: toggle
+
+    .. literalinclude:: ../examples/session_patch.py
+        :lines: 1,6-
+
+
+Cache expiration
+~~~~~~~~~~~~~~~~
+.. include:: ../examples/expiration.py
+    :start-line: 2
+    :end-line: 3
+
+.. admonition:: Example code
+    :class: toggle
+
+    .. literalinclude:: ../examples/expiration.py
+        :lines: 1,5-
+
+
+Logging requests
+~~~~~~~~~~~~~~~~
+.. include:: ../examples/log_requests.py
+    :start-line: 2
+    :end-line: 3
+
+.. admonition:: Example code
+    :class: toggle
+
+    .. literalinclude:: ../examples/log_requests.py
+        :lines: 1,5-
+
+
+Converting an old cache
+~~~~~~~~~~~~~~~~~~~~~~~
+.. include:: ../examples/convert_cache.py
+    :start-line: 2
+    :end-line: 4
+
+.. admonition:: Example code
+    :class: toggle
+
+    .. literalinclude:: ../examples/convert_cache.py
+        :lines: 1,6-
+
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/requests-cache-0.6.2/docs/index.rst 
new/requests-cache-0.6.3/docs/index.rst
--- old/requests-cache-0.6.2/docs/index.rst     2021-04-14 17:42:10.000000000 
+0200
+++ new/requests-cache-0.6.3/docs/index.rst     2021-04-21 17:51:30.000000000 
+0200
@@ -15,6 +15,7 @@
     user_guide
     advanced_usage
     security
+    examples
     api
     contributing
     contributors
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/requests-cache-0.6.2/docs/related_projects.rst 
new/requests-cache-0.6.3/docs/related_projects.rst
--- old/requests-cache-0.6.2/docs/related_projects.rst  2021-04-14 
17:42:10.000000000 +0200
+++ new/requests-cache-0.6.3/docs/related_projects.rst  2021-04-21 
17:51:30.000000000 +0200
@@ -15,3 +15,5 @@
   ``aiohttp`` web server
 * `aiocache <https://github.com/aio-libs/aiocache>`_: General-purpose (not 
HTTP-specific) async cache
   backends
+* `flask-caching <https://github.com/sh4nks/flask-caching>`_: A server-side 
HTTP cache for
+  applications using the Flask framework
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/requests-cache-0.6.2/examples/README.md 
new/requests-cache-0.6.3/examples/README.md
--- old/requests-cache-0.6.2/examples/README.md 2021-04-14 17:42:10.000000000 
+0200
+++ new/requests-cache-0.6.3/examples/README.md 2021-04-21 17:51:30.000000000 
+0200
@@ -1,2 +1,3 @@
 # Requests-Cache Examples
-This folder contains some complete examples for using the main features of 
requests-cache.
+This folder contains some complete examples that demonstrate the main features 
of requests-cache.
+These are also viewable on 
[readthedocs](https://requests-cache.readthedocs.io/en/latest/examples.html).
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/requests-cache-0.6.2/examples/basic_usage.py 
new/requests-cache-0.6.3/examples/basic_usage.py
--- old/requests-cache-0.6.2/examples/basic_usage.py    2021-04-14 
17:42:10.000000000 +0200
+++ new/requests-cache-0.6.3/examples/basic_usage.py    2021-04-21 
17:51:30.000000000 +0200
@@ -1,6 +1,8 @@
 #!/usr/bin/env python
 # flake8: noqa: F841
-"""A Simple example using requests-cache with httpbin"""
+"""
+A simple example using requests-cache with httpbin
+"""
 import time
 
 from requests_cache import CachedSession
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/requests-cache-0.6.2/examples/convert_cache.py 
new/requests-cache-0.6.3/examples/convert_cache.py
--- old/requests-cache-0.6.2/examples/convert_cache.py  2021-04-14 
17:42:10.000000000 +0200
+++ new/requests-cache-0.6.3/examples/convert_cache.py  2021-04-21 
17:51:30.000000000 +0200
@@ -1,5 +1,6 @@
 #!/usr/bin/env python
-"""Example of converting data cached in older versions of requests-cache 
(<=0.5.2)
+"""
+Example of converting data cached in older versions of requests-cache (<=0.5.2)
 into the current format
 """
 from requests import Response
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/requests-cache-0.6.2/examples/expiration.py 
new/requests-cache-0.6.3/examples/expiration.py
--- old/requests-cache-0.6.2/examples/expiration.py     2021-04-14 
17:42:10.000000000 +0200
+++ new/requests-cache-0.6.3/examples/expiration.py     2021-04-21 
17:51:30.000000000 +0200
@@ -1,5 +1,7 @@
 #!/usr/bin/env python
-"""An example of setting expiration for individual requests"""
+"""
+An example of setting expiration for individual requests
+"""
 import time
 
 from requests_cache import CachedSession
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/requests-cache-0.6.2/examples/log_requests.py 
new/requests-cache-0.6.3/examples/log_requests.py
--- old/requests-cache-0.6.2/examples/log_requests.py   1970-01-01 
01:00:00.000000000 +0100
+++ new/requests-cache-0.6.3/examples/log_requests.py   2021-04-21 
17:51:30.000000000 +0200
@@ -0,0 +1,46 @@
+#!/usr/bin/env python3
+"""
+An example of testing the cache to prove that it's not making more requests 
than expected.
+"""
+from contextlib import contextmanager
+from logging import basicConfig, getLogger
+from unittest.mock import patch
+
+import requests
+
+from requests_cache import CachedSession
+from requests_cache.session import OriginalSession, set_response_defaults
+
+basicConfig(level='INFO')
+logger = getLogger('requests_cache.examples')
+# Uncomment for more verbose debug output
+# getLogger('requests_cache').setLevel('DEBUG')
+
+
+@contextmanager
+def log_requests():
+    """Context manager that mocks and logs all non-cached requests"""
+    real_response = 
set_response_defaults(requests.get('http://httpbin.org/get'))
+    with patch.object(OriginalSession, 'send', return_value=real_response) as 
mock_send:
+        session = CachedSession('cache-test', backend='sqlite')
+        session.cache.clear()
+        yield session
+        cached_responses = session.cache.responses.values()
+
+    logger.debug('All calls to Session._request():')
+    logger.debug(mock_send.mock_calls)
+
+    logger.info(f'Responses cached: {len(cached_responses)}')
+    logger.info(f'Requests sent: {mock_send.call_count}')
+
+
+def main():
+    """Example usage; replace with any other requests you want to test"""
+    with log_requests() as session:
+        for i in range(10):
+            response = session.get('http://httpbin.org/get')
+            logger.debug(f'Response {i}: {type(response).__name__}')
+
+
+if __name__ == '__main__':
+    main()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/requests-cache-0.6.2/examples/session_patch.py 
new/requests-cache-0.6.3/examples/session_patch.py
--- old/requests-cache-0.6.2/examples/session_patch.py  2021-04-14 
17:42:10.000000000 +0200
+++ new/requests-cache-0.6.3/examples/session_patch.py  2021-04-21 
17:51:30.000000000 +0200
@@ -1,6 +1,8 @@
 #!/usr/bin/env python
 # flake8: noqa: F841
-"""The same as `basic_usage.py`, but using global session patching"""
+"""
+The same as ``basic_usage.py``, but using global session patching
+"""
 import time
 
 import requests
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/requests-cache-0.6.2/pyproject.toml 
new/requests-cache-0.6.3/pyproject.toml
--- old/requests-cache-0.6.2/pyproject.toml     2021-04-14 17:42:10.000000000 
+0200
+++ new/requests-cache-0.6.3/pyproject.toml     2021-04-21 17:51:30.000000000 
+0200
@@ -11,6 +11,9 @@
 [tool.coverage.run]
 branch = true
 source = ['requests_cache']
+omit = [
+    'requests_cache/__init__.py',
+]
 
 [tool.isort]
 profile = "black"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/requests-cache-0.6.2/requests_cache/__init__.py 
new/requests-cache-0.6.3/requests_cache/__init__.py
--- old/requests-cache-0.6.2/requests_cache/__init__.py 2021-04-14 
17:42:10.000000000 +0200
+++ new/requests-cache-0.6.3/requests_cache/__init__.py 2021-04-21 
17:51:30.000000000 +0200
@@ -1,5 +1,8 @@
 # flake8: noqa: E402,F401
-__version__ = '0.6.2'
+from logging import getLogger
+from os import getenv
+
+__version__ = '0.6.3'
 
 try:
     from .response import AnyResponse, CachedHTTPResponse, CachedResponse, 
ExpirationTime
@@ -17,3 +20,18 @@
 # Quietly ignore ImportError, if setup.py is invoked outside a virtualenv
 except ImportError:
     pass
+
+
+def get_prerelease_version(version: str) -> str:
+    """If we're running in a GitHub Action job on the dev branch, get a 
prerelease semantic version
+    using the current build number. For example: ``1.0.0 -> 1.0.0-dev.123``
+    """
+    if getenv('GITHUB_REF') == 'refs/heads/dev':
+        build_number = getenv('GITHUB_RUN_NUMBER', '0')
+        version = f'{version}.dev{build_number}'
+        getLogger(__name__).info(f'Using pre-release version: {version}')
+    return version
+
+
+# This won't modify the version outside of a GitHub Action
+__version__ = get_prerelease_version(__version__)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/requests-cache-0.6.2/requests_cache/backends/base.py 
new/requests-cache-0.6.3/requests_cache/backends/base.py
--- old/requests-cache-0.6.2/requests_cache/backends/base.py    2021-04-14 
17:42:10.000000000 +0200
+++ new/requests-cache-0.6.3/requests_cache/backends/base.py    2021-04-21 
17:51:30.000000000 +0200
@@ -21,11 +21,17 @@
     See :ref:`advanced_usage:custom backends` for details on creating your own 
implementation.
     """
 
-    def __init__(self, *args, **kwargs):
+    def __init__(
+        self,
+        *args,
+        include_get_headers: bool = False,
+        ignored_parameters: Iterable[str] = None,
+        **kwargs,
+    ):
         self.redirects = {}
         self.responses = {}
-        self._include_get_headers = kwargs.get("include_get_headers", False)
-        self._ignored_parameters = set(kwargs.get("ignored_parameters") or [])
+        self.include_get_headers = include_get_headers
+        self.ignored_parameters = ignored_parameters
 
     @property
     def urls(self) -> List[str]:
@@ -87,7 +93,7 @@
         try:
             response = self.responses[key] or 
self.responses[self.redirects[key]]
             for r in response.history:
-                del self.redirects[create_key(r.request, 
self._ignored_parameters)]
+                del self.redirects[create_key(r.request, 
self.ignored_parameters)]
         except Exception:
             pass
 
@@ -95,7 +101,7 @@
         """Delete response + redirects associated with `url` from cache.
         Works only for GET requests.
         """
-        self.delete(url_to_key(url, self._ignored_parameters))
+        self.delete(url_to_key(url, self.ignored_parameters))
 
     def clear(self):
         """Delete all items from the cache"""
@@ -135,7 +141,7 @@
 
     def create_key(self, request: requests.PreparedRequest, **kwargs) -> str:
         """Create a normalized cache key from a request object"""
-        return create_key(request, self._ignored_parameters, 
self._include_get_headers, **kwargs)
+        return create_key(request, self.ignored_parameters, 
self.include_get_headers, **kwargs)
 
     def has_key(self, key: str) -> bool:
         """Returns `True` if cache has `key`, `False` otherwise"""
@@ -143,7 +149,7 @@
 
     def has_url(self, url: str) -> bool:
         """Returns `True` if cache has `url`, `False` otherwise. Works only 
for GET request urls"""
-        return self.has_key(url_to_key(url, self._ignored_parameters))  # 
noqa: W601
+        return self.has_key(url_to_key(url, self.ignored_parameters))  # noqa: 
W601
 
     def __str__(self):
         return f'redirects: {len(self.redirects)}\nresponses: 
{len(self.responses)}'
@@ -170,6 +176,9 @@
         self._serializer = serializer or self._get_serializer(secret_key, salt)
         logger.debug(f'Initializing {type(self).__name__} with serializer: 
{self._serializer}')
 
+        # Show a warning instead of an exception if there are remaining unused 
kwargs
+        kwargs.pop('include_get_headers', None)
+        kwargs.pop('ignored_params', None)
         if kwargs:
             logger.warning(f'Unrecognized keyword arguments: {kwargs}')
         if not secret_key:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/requests-cache-0.6.2/requests_cache/backends/gridfs.py 
new/requests-cache-0.6.3/requests_cache/backends/gridfs.py
--- old/requests-cache-0.6.2/requests_cache/backends/gridfs.py  2021-04-14 
17:42:10.000000000 +0200
+++ new/requests-cache-0.6.3/requests_cache/backends/gridfs.py  2021-04-21 
17:51:30.000000000 +0200
@@ -67,7 +67,7 @@
         self.fs.delete(res._id)
 
     def __len__(self):
-        return self.db['fs.files'].count()
+        return self.db['fs.files'].estimated_document_count()
 
     def __iter__(self):
         for d in self.fs.find():
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/requests-cache-0.6.2/requests_cache/backends/mongo.py 
new/requests-cache-0.6.3/requests_cache/backends/mongo.py
--- old/requests-cache-0.6.2/requests_cache/backends/mongo.py   2021-04-14 
17:42:10.000000000 +0200
+++ new/requests-cache-0.6.3/requests_cache/backends/mongo.py   2021-04-21 
17:51:30.000000000 +0200
@@ -57,7 +57,7 @@
             raise KeyError
 
     def __len__(self):
-        return self.collection.count()
+        return self.collection.estimated_document_count()
 
     def __iter__(self):
         for d in self.collection.find({}, {'_id': True}):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/requests-cache-0.6.2/requests_cache/cache_keys.py 
new/requests-cache-0.6.3/requests_cache/cache_keys.py
--- old/requests-cache-0.6.2/requests_cache/cache_keys.py       2021-04-14 
17:42:10.000000000 +0200
+++ new/requests-cache-0.6.3/requests_cache/cache_keys.py       2021-04-21 
17:51:30.000000000 +0200
@@ -66,7 +66,7 @@
 
 
 def filter_params(data: List[Tuple], ignored_params: Iterable[str]) -> 
List[Tuple]:
-    return [(k, v) for k, v in data if k not in ignored_params]
+    return [(k, v) for k, v in data if k not in set(ignored_params)]
 
 
 def normalize_dict(items: RequestContent = None, normalize_data: bool = True) 
-> RequestContent:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/requests-cache-0.6.2/requests_cache/response.py 
new/requests-cache-0.6.3/requests_cache/response.py
--- old/requests-cache-0.6.2/requests_cache/response.py 2021-04-14 
17:42:10.000000000 +0200
+++ new/requests-cache-0.6.3/requests_cache/response.py 2021-04-21 
17:51:30.000000000 +0200
@@ -51,9 +51,19 @@
         self.request.hooks = []
 
         # Read content to support streaming requests, and reset file pointer 
on original request
-        self._content = original_response.content
-        if hasattr(original_response.raw, '_fp'):
-            original_response.raw._fp = BytesIO(self._content or b'')
+        if hasattr(original_response.raw, '_fp') and not 
original_response.raw.isclosed():
+            # Cache raw data
+            raw_data = original_response.raw.read(decode_content=False)
+            # Reset `_fp`
+            original_response.raw._fp = BytesIO(raw_data)
+            # Read and store (decoded) data
+            self._content = original_response.content
+            # Reset `_fp` again
+            original_response.raw._fp = BytesIO(raw_data)
+            original_response.raw._fp_bytes_read = 0
+            original_response.raw.length_remaining = len(raw_data)
+        else:
+            self._content = original_response.content
 
         # Copy raw response
         self._raw_response = None
@@ -123,21 +133,20 @@
     def release_conn(self):
         """No-op for compatibility"""
 
-    def read(self, amt=None, decode_content=False, **kwargs):
+    def read(self, amt=None, decode_content=None, **kwargs):
         """Simplified reader for cached content that emulates
         :py:meth:`urllib3.response.HTTPResponse.read()`
         """
-        data = self._fp.read(amt)
-        decode_content = self.decode_content if decode_content is None else 
decode_content
+        if 'content-encoding' in self.headers and (
+            decode_content is False or (decode_content is None and not 
self.decode_content)
+        ):
+            # Warn if content was encoded and decode_content is set to False
+            logger.warning('read() returns decoded data for cached responses, 
even with decode_content=False set')
 
+        data = self._fp.read(amt)
         # "close" the file to inform consumers to stop reading from it
         if not data:
             self._fp.close()
-        # Decode binary content, if specified
-        elif decode_content:
-            self._init_decoder()
-            data = self._decode(data, decode_content=True, flush_decoder=True)
-
         return data
 
     def stream(self, amt=None, **kwargs):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/requests-cache-0.6.2/requests_cache/session.py 
new/requests-cache-0.6.3/requests_cache/session.py
--- old/requests-cache-0.6.2/requests_cache/session.py  2021-04-14 
17:42:10.000000000 +0200
+++ new/requests-cache-0.6.3/requests_cache/session.py  2021-04-21 
17:51:30.000000000 +0200
@@ -2,6 +2,7 @@
 from contextlib import contextmanager
 from fnmatch import fnmatch
 from logging import getLogger
+from threading import RLock
 from typing import Any, Callable, Dict, Iterable
 
 from requests import PreparedRequest
@@ -44,6 +45,7 @@
         self._cache_name = cache_name
         self._request_expire_after: ExpirationTime = None
         self._disabled = False
+        self._lock = RLock()
 
         # Remove any requests-cache-specific kwargs before passing along to 
superclass
         session_kwargs = {k: v for k, v in kwargs.items() if k not in 
BACKEND_KWARGS}
@@ -163,11 +165,15 @@
     def cache_disabled(self):
         """
         Context manager for temporary disabling the cache
-        ::
+
+        .. warning:: This method is not thread-safe.
+
+        Example:
 
             >>> s = CachedSession()
             >>> with s.cache_disabled():
             ...     s.get('http://httpbin.org/ip')
+
         """
         if self._disabled:
             yield
@@ -195,10 +201,13 @@
 
     @contextmanager
     def request_expire_after(self, expire_after: ExpirationTime = None):
-        """Temporarily override ``expire_after`` for individual requests"""
-        self._request_expire_after = expire_after
-        yield
-        self._request_expire_after = None
+        """Temporarily override ``expire_after`` for an individual request. 
This is needed to
+        persist the value between requests.Session.request() -> send()."""
+        # TODO: Is there a way to pass this via request kwargs -> 
PreparedRequest?
+        with self._lock:
+            self._request_expire_after = expire_after
+            yield
+            self._request_expire_after = None
 
     def remove_expired_responses(self, expire_after: ExpirationTime = None):
         """Remove expired responses from the cache, optionally with 
revalidation
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/requests-cache-0.6.2/requests_cache.egg-info/PKG-INFO 
new/requests-cache-0.6.3/requests_cache.egg-info/PKG-INFO
--- old/requests-cache-0.6.2/requests_cache.egg-info/PKG-INFO   2021-04-14 
17:42:23.000000000 +0200
+++ new/requests-cache-0.6.3/requests_cache.egg-info/PKG-INFO   2021-04-21 
17:51:49.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: requests-cache
-Version: 0.6.2
+Version: 0.6.3
 Summary: Persistent cache for requests library
 Home-page: https://github.com/reclosedev/requests-cache
 Author: Roman Haritonov
@@ -86,6 +86,11 @@
         
         # History
         
+        ### 0.6.3 (2021-TBD)
+        * Fix false positive warning with `include_get_headers`
+        * Fix handling of `decode_content` parameter for 
`CachedResponse.raw.read()`
+        * Replace deprecated pymongo `Collection.count()` with 
`estimated_document_count()`
+        
         ### 0.6.2 (2021-04-14)
         * Explicitly include docs, tests, and examples in sdist
         
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/requests-cache-0.6.2/requests_cache.egg-info/SOURCES.txt 
new/requests-cache-0.6.3/requests_cache.egg-info/SOURCES.txt
--- old/requests-cache-0.6.2/requests_cache.egg-info/SOURCES.txt        
2021-04-14 17:42:23.000000000 +0200
+++ new/requests-cache-0.6.3/requests_cache.egg-info/SOURCES.txt        
2021-04-21 17:51:49.000000000 +0200
@@ -18,17 +18,21 @@
 docs/contributing.rst
 docs/contributors.rst
 docs/docker-compose.yml
+docs/examples.rst
 docs/history.rst
 docs/index.rst
 docs/related_projects.rst
 docs/security.rst
 docs/user_guide.rst
 docs/_static/.empty
+docs/_static/collapsible_container.css
 docs/_templates/.empty
+docs/_templates/page.html
 examples/README.md
 examples/basic_usage.py
 examples/convert_cache.py
 examples/expiration.py
+examples/log_requests.py
 examples/session_patch.py
 requests_cache/__init__.py
 requests_cache/cache_keys.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/requests-cache-0.6.2/requests_cache.egg-info/requires.txt 
new/requests-cache-0.6.3/requests_cache.egg-info/requires.txt
--- old/requests-cache-0.6.2/requests_cache.egg-info/requires.txt       
2021-04-14 17:42:23.000000000 +0200
+++ new/requests-cache-0.6.3/requests_cache.egg-info/requires.txt       
2021-04-21 17:51:49.000000000 +0200
@@ -34,6 +34,7 @@
 psutil
 pytest>=5.0
 pytest-cov>=2.11
+pytest-order~=0.11.0
 pytest-xdist
 radon
 requests-mock>=1.8
@@ -57,6 +58,7 @@
 psutil
 pytest>=5.0
 pytest-cov>=2.11
+pytest-order~=0.11.0
 pytest-xdist
 radon
 requests-mock>=1.8
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/requests-cache-0.6.2/setup.py 
new/requests-cache-0.6.3/setup.py
--- old/requests-cache-0.6.2/setup.py   2021-04-14 17:42:10.000000000 +0200
+++ new/requests-cache-0.6.3/setup.py   2021-04-21 17:51:30.000000000 +0200
@@ -29,6 +29,7 @@
         'psutil',
         'pytest>=5.0',
         'pytest-cov>=2.11',
+        'pytest-order~=0.11.0',
         'pytest-xdist',
         'radon',
         'requests-mock>=1.8',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/requests-cache-0.6.2/tests/conftest.py 
new/requests-cache-0.6.3/tests/conftest.py
--- old/requests-cache-0.6.2/tests/conftest.py  2021-04-14 17:42:10.000000000 
+0200
+++ new/requests-cache-0.6.3/tests/conftest.py  2021-04-21 17:51:30.000000000 
+0200
@@ -1,5 +1,9 @@
 """Fixtures that will be automatically picked up by pytest
 
+Short description:
+* The ``mock_session`` fixture uses pre-configured mock requests, and should 
be used for unit tests.
+* The ``tempfile_session`` fixture makes real HTTP requests, and should be 
used for integration test.
+
 Note: The protocol ``http(s)+mock://`` helps :py:class:`requests_mock.Adapter` 
play nicely with
 :py:class:`requests.PreparedRequest`. More info here:
 https://requests-mock.readthedocs.io/en/latest/adapter.html
@@ -37,22 +41,22 @@
     return f'{base_url}/{path}'
 
 
-"""The following allows pytest-httpbin to be used instead of the httpbin 
container.
-A server will be started via an autoused fixture if both:
-* pytest-httpbin is installed
-* The environment variable USE_PYTEST_HTTPBIN is set to 'true'
-"""
 try:
     import pytest_httpbin  # noqa: F401
 
     USE_PYTEST_HTTPBIN = os.getenv('USE_PYTEST_HTTPBIN', '').lower() == 'true'
-    logger.info('Using pytest-httpin for integration tests')
 except ImportError:
     USE_PYTEST_HTTPBIN = False
 
 
 @pytest.fixture(scope='session', autouse=USE_PYTEST_HTTPBIN)
 def httpbin_wrapper(httpbin):
+    """Allow pytest-httpbin to be used instead of the httpbin Docker 
container. This fixture does
+    not need to be used manually. It will be autoused if both:
+    * pytest-httpbin is installed
+    * The environment variable USE_PYTEST_HTTPBIN is set to 'true'
+    """
+    logger.info('Using pytest-httpin for integration tests')
     os.environ['HTTPBIN_URL'] = httpbin.url
     return httpbin
 
@@ -95,7 +99,6 @@
             suppress_warnings=True,
         )
         yield session
-    requests_cache.uninstall_cache()
 
 
 @pytest.fixture(scope='function')
@@ -167,7 +170,7 @@
     @wraps(func)
     def wrapper(*args, **kwargs):
         try:
-            timeout(0.5)(func)(*args, **kwargs)
+            timeout(1.0)(func)(*args, **kwargs)
         except Exception as e:
             logger.error(e)
             pytest.fail('Could not connect to backend')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/requests-cache-0.6.2/tests/integration/test_cache.py 
new/requests-cache-0.6.3/tests/integration/test_cache.py
--- old/requests-cache-0.6.2/tests/integration/test_cache.py    2021-04-14 
17:42:10.000000000 +0200
+++ new/requests-cache-0.6.3/tests/integration/test_cache.py    2021-04-21 
17:51:30.000000000 +0200
@@ -2,6 +2,7 @@
 import json
 import pytest
 
+from requests_cache import CachedResponse
 from tests.conftest import USE_PYTEST_HTTPBIN, httpbin
 
 HTTPBIN_METHODS = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE']
@@ -73,3 +74,23 @@
     with tempfile_session.cache_disabled():
         response_3 = get_json(httpbin('cookies/set/test3/test4'))
         assert response_3 == get_json(httpbin('cookies'))
+
+
+def test_response_decode(tempfile_session):
+    """Test that a gzip-compressed raw response can be manually uncompressed 
with decode_content"""
+    response = tempfile_session.get(httpbin('gzip'))
+    assert b'gzipped' in response.content
+
+    cached = CachedResponse(response)
+    assert b'gzipped' in cached.content
+    assert b'gzipped' in cached.raw.read(None, decode_content=True)
+
+
+def test_response_decode_stream(tempfile_session):
+    """Test that streamed gzip-compressed responses can be uncompressed with 
decode_content"""
+    response_uncached = tempfile_session.get(httpbin('gzip'), stream=True)
+    response_cached = tempfile_session.get(httpbin('gzip'), stream=True)
+
+    for res in (response_uncached, response_cached):
+        assert b'gzipped' in res.content
+        assert b'gzipped' in res.raw.read(None, decode_content=True)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/requests-cache-0.6.2/tests/integration/test_dynamodb.py 
new/requests-cache-0.6.3/tests/integration/test_dynamodb.py
--- old/requests-cache-0.6.2/tests/integration/test_dynamodb.py 2021-04-14 
17:42:10.000000000 +0200
+++ new/requests-cache-0.6.3/tests/integration/test_dynamodb.py 2021-04-21 
17:51:30.000000000 +0200
@@ -5,6 +5,9 @@
 from tests.conftest import fail_if_no_connection
 from tests.integration.test_backends import BaseStorageTestCase
 
+# Run this test module last, since the DynamoDB container takes the longest to 
initialize
+pytestmark = pytest.mark.order(-1)
+
 boto_options = {
     'endpoint_url': 'http://localhost:8000',
     'region_name': 'us-east-1',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/requests-cache-0.6.2/tests/unit/test_cache.py 
new/requests-cache-0.6.3/tests/unit/test_cache.py
--- old/requests-cache-0.6.2/tests/unit/test_cache.py   2021-04-14 
17:42:10.000000000 +0200
+++ new/requests-cache-0.6.3/tests/unit/test_cache.py   2021-04-21 
17:51:30.000000000 +0200
@@ -82,7 +82,7 @@
     """Test all relevant combinations of methods and data fields. Requests 
with different request
     params, data, or json should not be cached under different keys based on 
an ignored param.
     """
-    mock_session.cache._ignored_parameters = ['ignored']
+    mock_session.cache.ignored_parameters = ['ignored']
     params_1 = {'ignored': 1, 'not ignored': 1}
     params_2 = {'ignored': 2, 'not ignored': 1}
     params_3 = {'ignored': 2, 'not ignored': 2}
@@ -292,18 +292,18 @@
     assert response_2.is_expired is response_3.is_expired is False
 
 
-def test_include_get_headers(mock_session):
+def testinclude_get_headers(mock_session):
     """With include_get_headers, requests with different headers should have 
different cache keys"""
-    mock_session.cache._include_get_headers = True
+    mock_session.cache.include_get_headers = True
     headers_list = [{'Accept': 'text/json'}, {'Accept': 'text/xml'}, 
{'Accept': 'custom'}, None]
     for headers in headers_list:
         assert mock_session.get(MOCKED_URL, headers=headers).from_cache is 
False
         assert mock_session.get(MOCKED_URL, headers=headers).from_cache is True
 
 
-def test_include_get_headers_normalize(mock_session):
+def testinclude_get_headers_normalize(mock_session):
     """With include_get_headers, the same headers (in any order) should have 
the same cache key"""
-    mock_session.cache._include_get_headers = True
+    mock_session.cache.include_get_headers = True
     headers = {'Accept': 'text/json', 'Custom': 'abc'}
     reversed_headers = {'Custom': 'abc', 'Accept': 'text/json'}
     assert mock_session.get(MOCKED_URL, headers=headers).from_cache is False
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/requests-cache-0.6.2/tests/unit/test_response.py 
new/requests-cache-0.6.3/tests/unit/test_response.py
--- old/requests-cache-0.6.2/tests/unit/test_response.py        2021-04-14 
17:42:10.000000000 +0200
+++ new/requests-cache-0.6.3/tests/unit/test_response.py        2021-04-21 
17:51:30.000000000 +0200
@@ -1,4 +1,3 @@
-import gzip
 import pytest
 from datetime import datetime, timedelta
 from io import BytesIO
@@ -72,22 +71,6 @@
     assert response.raw.read(None) == b'mock response'
 
 
-def test_raw_response__decode(mock_session):
-    """Test that a gzip-compressed raw response can be manually uncompressed 
with decode_content"""
-    url = f'{MOCKED_URL}/utf-8'
-    mock_session.mock_adapter.register_uri(
-        'GET',
-        url,
-        status_code=200,
-        body=BytesIO(gzip.compress(b'compressed response')),
-        headers={'content-encoding': 'gzip'},
-    )
-    response = CachedResponse(mock_session.get(url))
-    # Requests will have already read this, but let's just pretend we want to 
do it manually
-    response.raw._fp = BytesIO(gzip.compress(b'compressed response'))
-    assert response.raw.read(None, decode_content=True) == b'compressed 
response'
-
-
 def test_raw_response__stream(mock_session):
     response = CachedResponse(mock_session.get(MOCKED_URL))
     data = b''

Reply via email to