Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update caching.py #125

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions pygbif/caching.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
import os.path
import tempfile

try:
from requests_cache import remove_expired_responses
except ModuleNotFoundError:
from requests_cache.core import remove_expired_responses

def caching(
cache=False,
name=None,
Expand Down Expand Up @@ -88,7 +83,7 @@ def caching(
requests_cache.install_cache(
cache_name=CACHE_NAME, backend=backend, expire_after=expire_after
)
remove_expired_responses()
requests_cache.delete(expired=True)()
Copy link

@airnst airnst Feb 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fails, since it does not return a callable object (see screenshot). At least if the cache is empty. Should be requests_cache.delete(expired=True) without the trailing parentheses.

Suggested change
requests_cache.delete(expired=True)()
requests_cache.delete(expired=True)

image


cache_settings = {
"cache": cache,
Expand Down
Loading