nasa ads throws error with example code
- Dominant language
- Python
- Stars
- 791
- Forks
- 451
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 4
Description
Hi, as the title says the nasa_ads query throws an error with the example code:
```python
results = ads.ADS.query_simple('^Persson Origin of water around deeply embedded low-mass protostars')
```
results in
```python
---------------------------------------------------------------------------
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__..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'
```
Contributor guide
Research direction
Start in astroquery/nasa_ads/core.py at ADSClass.query_simple and _parse_response, then reproduce the documented query to inspect the returned response shape. Determine how a response whose first document lacks bibcode should be handled, and verify that the example no longer raises an unexpected KeyError while preserving the intended no-results behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100