Skip to content

Commit afd1ac0

Browse files
committed
change URL for atomic and improve error messaging
1 parent 3d3dd0d commit afd1ac0

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

astroquery/atomic/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class Conf(_config.ConfigNamespace):
7777
Configuration parameters for `astroquery.atomic`.
7878
"""
7979
url = _config.ConfigItem(
80-
'https://www.pa.uky.edu/~peter/atomic/',
80+
'https://linelist.pa.uky.edu/atomic/',
8181
'Atomic Line List URL')
8282

8383
timeout = _config.ConfigItem(

astroquery/atomic/core.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,10 @@ def query_object_async(self, *, wavelength_range=None, wavelength_type='', wavel
248248
return response
249249

250250
def _parse_result(self, response):
251+
252+
if 'ERROR: request form contains no information' in response.text:
253+
raise ValueError(f"The server returned an error. Please check the URL. The full error message is {response.text}")
254+
251255
data = StringIO(BeautifulSoup(response.text, features='html5lib').find('pre').text.strip())
252256
# `header` is e.g.:
253257
# "u'-LAMBDA-VAC-ANG-|-SPECTRUM--|TT|--------TERM---------|---J-J---|----LEVEL-ENERGY--CM-1----'"
@@ -299,6 +303,7 @@ def _submit_form(self, input_data=None, cache=True):
299303
log.debug(f"final payload = {payload} from url={url}")
300304
response = self._request("POST", url=url, data=payload,
301305
timeout=self.TIMEOUT, cache=cache)
306+
response.raise_for_status()
302307
log.debug("Retrieved data from POST request")
303308
return response
304309

0 commit comments

Comments
 (0)