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

esdoc search cannot exploit https; more informative error needed #15

Open
bnlawrence opened this issue Apr 2, 2019 · 0 comments
Open

Comments

@bnlawrence
Copy link
Member

This probably should not raise a JSON error, since the actual error is not a JSON error, but something to do with the transport and/or what is returned ...

The following code works:

os.environ['ESDOC_API'] = 'http://test-api.es-doc.org/'
import pyesdoc as esd
docs = esd.search('cmip6','experiments')
docs

returning

Out[5]: {'count': 289}

The following does not:

os.environ['ESDOC_API'] = 'https://test-api.es-doc.org/'
import pyesdoc as esd
docs = esd.search('cmip6','experiments')

returning

    docs = esd.search('cmip6','experiments')
  File "/Users/BNL28/anaconda3/envs/py27/lib/python2.7/site-packages/pyesdoc/_search.py", line 83, in search
    return SearchResult(json.loads(response.text))
  File "/Users/BNL28/anaconda3/envs/py27/lib/python2.7/json/__init__.py", line 339, in loads
    return _default_decoder.decode(s)
  File "/Users/BNL28/anaconda3/envs/py27/lib/python2.7/json/decoder.py", line 364, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/Users/BNL28/anaconda3/envs/py27/lib/python2.7/json/decoder.py", line 382, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded``
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

1 participant