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

Change splatalogue url #1817

Merged
merged 3 commits into from Sep 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.rst
Expand Up @@ -22,6 +22,9 @@ Splatalogue
directory (Issue [#423]) The scraping function has also been updated to reflect
the Splatalogue webpage. [#1772]

- The splatalogue URL has changed to https://splatalogue.online, as the old site
stopped functioning in September 2020 [#1817]

UKIDSS
^^^^^^

Expand Down
5 changes: 4 additions & 1 deletion astroquery/splatalogue/__init__.py
Expand Up @@ -19,8 +19,11 @@ class Conf(_config.ConfigNamespace):
slap_url = _config.ConfigItem(
'https://find.nrao.edu/splata-slap/slap',
'Splatalogue SLAP interface URL (not used).')
base_url = 'https://splatalogue.online'
query_url = _config.ConfigItem(
'https://www.cv.nrao.edu/php/splat/c_export.php',
f'{base_url}/c_export.php',
# defunct as of Sep 4, 2020? (keeping because this is likely the true host)
# 'https://www.cv.nrao.edu/php/splat/c_export.php',
'Splatalogue web interface URL.')
timeout = _config.ConfigItem(
60,
Expand Down
6 changes: 4 additions & 2 deletions astroquery/splatalogue/build_species_table.py
Expand Up @@ -11,6 +11,8 @@

from astropy.config import paths

from . import conf


def data_path(filename: str):
"""
Expand All @@ -32,7 +34,7 @@ def data_path(filename: str):
return os.path.join(data_dir, filename)


def get_json_species_ids(outfile='splat-species.json'):
def get_json_species_ids(outfile='splat-species.json', base_url=conf.base_url):
"""
Uses BeautifulSoup to scrape the NRAO Splatalogue species
selector form, and caches the result as JSON. The file
Expand All @@ -50,7 +52,7 @@ def get_json_species_ids(outfile='splat-species.json'):
"""
import bs4

result = requests.get('https://www.cv.nrao.edu/php/splat/b.php')
result = requests.get(f'{base_url}/b.php')
page = bs4.BeautifulSoup(result.content, 'html5lib')
# The ID needs to be checked periodically if Splatalogue is updated
sid = page.findAll('select', attrs={'id': 'speciesselectbox'})[0]
Expand Down
6 changes: 0 additions & 6 deletions astroquery/splatalogue/tests/test_splatalogue.py
Expand Up @@ -61,12 +61,6 @@ def test_load_species_table():
assert len(CO) == 4


# regression test: ConfigItems were in wrong order at one point
def test_url():
assert 'https://' in splatalogue.core.Splatalogue.QUERY_URL
assert 'cv.nrao.edu' in splatalogue.core.Splatalogue.QUERY_URL


# regression test: get_query_payload should work (#308)
def test_get_payload():
q = splatalogue.core.Splatalogue.query_lines_async(1 * u.GHz, 10 * u.GHz,
Expand Down