Skip to content

Commit

Permalink
Merge pull request #127 from lucbettaieb/luc/fix-caching
Browse files Browse the repository at this point in the history
Fix for #126 as initially proposed by @bbrangeo; pushing for speed (since i need it.. :) )
  • Loading branch information
CecSve committed Mar 1, 2024
2 parents 59960ff + c8e4c8d commit bc4d8fa
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 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)

cache_settings = {
"cache": cache,
Expand All @@ -98,4 +93,4 @@ def caching(
"allowable_codes": allowable_codes,
"allowable_methods": allowable_methods,
}
return cache_settings
return cache_settings

0 comments on commit bc4d8fa

Please sign in to comment.