summaryrefslogtreecommitdiff
path: root/requests_cache
diff options
context:
space:
mode:
authorJordan Cook <jordan.cook@pioneer.com>2021-04-10 19:44:31 -0500
committerJordan Cook <jordan.cook@pioneer.com>2021-04-10 19:44:31 -0500
commit7dfb7c0e3c0584c570eb192ffc14361ac36de8fa (patch)
tree9d970db92e8a7001f351985ddc9591443879fb93 /requests_cache
parent82076f063b66099df0ed24a260041b921656fb37 (diff)
downloadrequests-cache-7dfb7c0e3c0584c570eb192ffc14361ac36de8fa.tar.gz
Demote most logging.info statements to debug
Diffstat (limited to 'requests_cache')
-rw-r--r--requests_cache/backends/__init__.py2
-rw-r--r--requests_cache/backends/base.py4
-rw-r--r--requests_cache/patcher.py2
-rwxr-xr-xrequests_cache/response.py2
-rw-r--r--requests_cache/session.py8
5 files changed, 9 insertions, 9 deletions
diff --git a/requests_cache/backends/__init__.py b/requests_cache/backends/__init__.py
index 9f9af90..0cf9890 100644
--- a/requests_cache/backends/__init__.py
+++ b/requests_cache/backends/__init__.py
@@ -78,7 +78,7 @@ BACKEND_CLASSES = {
def init_backend(backend: BackendSpecifier, *args, **kwargs) -> BaseCache:
"""Initialize a backend given a name, class, or instance"""
- logger.info(f'Initializing backend: {backend}')
+ logger.debug(f'Initializing backend: {backend}')
# Omit 'cache_name' positional arg if an equivalent backend-specific kwarg is specified
if any([k in kwargs for k in CACHE_NAME_KWARGS]):
diff --git a/requests_cache/backends/base.py b/requests_cache/backends/base.py
index ad9f39c..16c101d 100644
--- a/requests_cache/backends/base.py
+++ b/requests_cache/backends/base.py
@@ -168,12 +168,12 @@ class BaseStorage(MutableMapping, ABC):
**kwargs,
):
self._serializer = serializer or self._get_serializer(secret_key, salt)
- logger.info(f'Initializing {type(self).__name__} with serializer: {type(self._serializer)}')
+ logger.debug(f'Initializing {type(self).__name__} with serializer: {self._serializer}')
if kwargs:
logger.warning(f'Unrecognized keyword arguments: {kwargs}')
if not secret_key:
- warn_func = logger.info if suppress_warnings else warnings.warn
+ warn_func = logger.debug if suppress_warnings else warnings.warn
warn_func('Using a secret key to sign cached items is recommended for this backend')
def serialize(self, item: ResponseOrKey) -> bytes:
diff --git a/requests_cache/patcher.py b/requests_cache/patcher.py
index bccef82..7d89acc 100644
--- a/requests_cache/patcher.py
+++ b/requests_cache/patcher.py
@@ -130,5 +130,5 @@ def remove_expired_responses(expire_after: ExpirationTime = None):
def _patch_session_factory(session_factory: Type[OriginalSession] = CachedSession):
- logger.info(f'Patching requests.Session with class: {type(session_factory).__name__}')
+ logger.debug(f'Patching requests.Session with class: {session_factory.__name__}')
requests.Session = requests.sessions.Session = session_factory # noqa
diff --git a/requests_cache/response.py b/requests_cache/response.py
index 2cd143d..b95a646 100755
--- a/requests_cache/response.py
+++ b/requests_cache/response.py
@@ -96,7 +96,7 @@ class CachedResponse(Response):
def raw(self) -> HTTPResponse:
"""Reconstruct a raw urllib response object from stored attrs"""
if not self._raw_response:
- logger.info('Rebuilding raw response object')
+ logger.debug('Rebuilding raw response object')
self._raw_response = CachedHTTPResponse(body=self._content, **self._raw_response_attrs)
return self._raw_response
diff --git a/requests_cache/session.py b/requests_cache/session.py
index e9ee2fe..24a48b1 100644
--- a/requests_cache/session.py
+++ b/requests_cache/session.py
@@ -99,7 +99,7 @@ class CacheMixin:
# If the request has been filtered out, delete previously cached response if it exists
cache_key = self.cache.create_key(response.request, **kwargs)
if not response.from_cache and not self.filter_fn(response):
- logger.info(f'Deleting filtered response for URL: {response.url}')
+ logger.debug(f'Deleting filtered response for URL: {response.url}')
self.cache.delete(cache_key)
return response
@@ -112,7 +112,7 @@ class CacheMixin:
"""Send a prepared request, with caching."""
# If we shouldn't cache the response, just send the request
if not self._is_cacheable(request):
- logger.info(f'Request for URL {request.url} is not cacheable')
+ logger.debug(f'Request for URL {request.url} is not cacheable')
response = super().send(request, **kwargs)
return set_response_defaults(response)
@@ -140,7 +140,7 @@ class CacheMixin:
def _handle_expired_response(self, request, response, cache_key, **kwargs) -> AnyResponse:
"""Determine what to do with an expired response, depending on old_data_on_error setting"""
# Attempt to send the request and cache the new response
- logger.info('Expired response; attempting to re-send request')
+ logger.debug('Expired response; attempting to re-send request')
try:
return self._send_and_cache(request, cache_key, **kwargs)
# Return the expired/invalid response on error, if specified; otherwise reraise
@@ -153,7 +153,7 @@ class CacheMixin:
raise
def _send_and_cache(self, request, cache_key, **kwargs):
- logger.info(f'Sending request and caching response for URL: {request.url}')
+ logger.debug(f'Sending request and caching response for URL: {request.url}')
response = super().send(request, **kwargs)
if response.status_code in self.allowable_codes:
self.cache.save_response(cache_key, response, self._get_expiration(request.url))