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

nasa ads throws error with example code #2926

Open
jvines opened this issue Jan 17, 2024 · 1 comment
Open

nasa ads throws error with example code #2926

jvines opened this issue Jan 17, 2024 · 1 comment

Comments

@jvines
Copy link

jvines commented Jan 17, 2024

Hi, as the title says the nasa_ads query throws an error with the example code:

results = ads.ADS.query_simple('^Persson Origin of water around deeply embedded low-mass protostars')

results in

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
Cell In[28], line 1
----> 1 results = ads.ADS.query_simple('^Persson Origin of water around deeply embedded low-mass protostars')

File ~/opt/anaconda3/lib/python3.8/site-packages/astroquery/utils/class_or_instance.py:25, in class_or_instance.__get__.<locals>.f(*args, **kwds)
     23 def f(*args, **kwds):
     24     if obj is not None:
---> 25         return self.fn(obj, *args, **kwds)
     26     else:
     27         return self.fn(cls, *args, **kwds)

File ~/opt/anaconda3/lib/python3.8/site-packages/astroquery/nasa_ads/core.py:70, in ADSClass.query_simple(self, query_string, get_query_payload, get_raw_response, cache)
     68     return response
     69 # parse the XML response into AstroPy Table
---> 70 resulttable = self._parse_response(response.json())
     72 return resulttable

File ~/opt/anaconda3/lib/python3.8/site-packages/astroquery/nasa_ads/core.py:77, in ADSClass._parse_response(self, response)
     74 def _parse_response(self, response):
     76     try:
---> 77         response['response']['docs'][0]['bibcode']
     78     except IndexError:
     79         raise RuntimeError('No results returned!')

KeyError: 'bibcode'
@keflavich
Copy link
Contributor

I can't reproduce this error:

from astroquery.nasa_ads import ADS
results = ADS.query_simple('^Persson Origin of water around deeply embedded low-mass protostars')

returns a valid table. I tried with a couple other names too, all worked fine. @jvines, try again? Say also what version of astroquery you're using.

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

No branches or pull requests

3 participants