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

Error with requests_cache dependency #71

Closed
agstephens opened this issue Jul 1, 2021 · 5 comments
Closed

Error with requests_cache dependency #71

agstephens opened this issue Jul 1, 2021 · 5 comments
Assignees

Comments

@agstephens
Copy link
Contributor

Mark at the MO reported this error when running this code:

from pyesgf.search import SearchConnection
conn = SearchConnection('http://esgf-index1.ceda.ac.uk/esg-search', distrib=True)

ctx = conn.new_context(project='CMIP5', query='humidity')
ctx.hit_count

Error:

/usr/local/lib/python3.7/dist-packages/pyesgf/search/connection.py in
open(self)
     96     def open(self):
     97         if (isinstance(self._passed_session, requests.Session)
or isinstance(
---> 98                 self._passed_session,
requests_cache.core.CachedSession)):
     99             self.session = self._passed_session
    100         else:

AttributeError: module 'requests_cache' has no attribute 'core'

A quick search suggests that the API inside the package has changed.

An older version worked fine:

requests_cache-0.4.1

The new version that failed was:

requests_cache-0.6.4

Needs further investigation.

@agstephens
Copy link
Contributor Author

Versions of requests_cache when current esgf-pyclient works: 0.5.2
Versions of requests_cache when we get this error: >=0.6.0

@JWCook
Copy link

JWCook commented Jul 2, 2021

The reference to requests_cache.core.CachedSession just needs to be changed to requests_cache.CachedSession.

@agstephens
Copy link
Contributor Author

Thanks @JWCook
I have checked this works all the way back to version 0.4.13 of requests_cache (as packaged in conda-forge) - so it should be fine to make the change.

@agstephens
Copy link
Contributor Author

@alaniwi here is one for you to look at next week (when I'm on leave).

@agstephens agstephens mentioned this issue Jul 9, 2021
6 tasks
@alaniwi
Copy link
Collaborator

alaniwi commented Jul 26, 2021

The updates to the library API have already been made at a41c524 which is in master.

Tests are passing with this change (for more details see #72).

Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants