astroquery
astroquery copied to clipboard
nasa ads throws error with example code
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'
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.