Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- MAST: bugfix, removing filesize checking due to unreliable filesize reporting in the database [#1050]
- MAST: Added Catalogs class. [#1049]
- New tool: Open Astronomy Catalog API to obtain data products on supernovae, TDEs, and kilonovae. [#1053]
- IRSA Dust: call over https. [#1069]

0.3.7 (2018-01-25)
------------------
Expand Down
2 changes: 1 addition & 1 deletion astroquery/irsa_dust/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Conf(_config.ConfigNamespace):
"""
# maintain a list of URLs in case the user wants to append a mirror
server = _config.ConfigItem(
['http://irsa.ipac.caltech.edu/cgi-bin/DUST/nph-dust'],
['https://irsa.ipac.caltech.edu/cgi-bin/DUST/nph-dust'],
'Name of the irsa_dust server to use.')
timeout = _config.ConfigItem(
30,
Expand Down
14 changes: 7 additions & 7 deletions astroquery/irsa_dust/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def get_images(self, coordinate, radius=None,
Can be either the name of an object or a coordinate string
If a name, must be resolvable by NED, SIMBAD, 2MASS, or SWAS.
Examples of acceptable coordinate strings, can be found `here.
<http://irsa.ipac.caltech.edu/applications/DUST/docs/coordinate.html>`_
<https://irsa.ipac.caltech.edu/applications/DUST/docs/coordinate.html>`_
radius : str / `~astropy.units.Quantity`, optional
The size of the region to include in the dust query, in radian,
degree or hour as per format specified by
Expand Down Expand Up @@ -105,7 +105,7 @@ def get_images_async(self, coordinate, radius=None, image_type=None,
Can be either the name of an object or a coordinate string
If a name, must be resolvable by NED, SIMBAD, 2MASS, or SWAS.
Examples of acceptable coordinate strings, can be found `here.
<http://irsa.ipac.caltech.edu/applications/DUST/docs/coordinate.html>`_
<https://irsa.ipac.caltech.edu/applications/DUST/docs/coordinate.html>`_
radius : str / `~astropy.units.Quantity`, optional
The size of the region to include in the dust query, in radian,
degree or hour as per format specified by
Expand Down Expand Up @@ -151,7 +151,7 @@ def get_image_list(self, coordinate, radius=None, image_type=None,
Can be either the name of an object or a coordinate string
If a name, must be resolvable by NED, SIMBAD, 2MASS, or SWAS.
Examples of acceptable coordinate strings, can be found `here.
<http://irsa.ipac.caltech.edu/applications/DUST/docs/coordinate.html>`_
<https://irsa.ipac.caltech.edu/applications/DUST/docs/coordinate.html>`_
radius : str / `~astropy.units.Quantity`, optional
The size of the region to include in the dust query, in radian,
degree or hour as per format specified by
Expand Down Expand Up @@ -192,7 +192,7 @@ def get_extinction_table(self, coordinate, radius=None, timeout=TIMEOUT,
Can be either the name of an object or a coordinate string
If a name, must be resolvable by NED, SIMBAD, 2MASS, or SWAS.
Examples of acceptable coordinate strings, can be found `here.
<http://irsa.ipac.caltech.edu/applications/DUST/docs/coordinate.html>`_
<https://irsa.ipac.caltech.edu/applications/DUST/docs/coordinate.html>`_
radius : str / `~astropy.units.Quantity`, optional
The size of the region to include in the dust query, in radian,
degree or hour as per format specified by
Expand Down Expand Up @@ -233,7 +233,7 @@ def get_extinction_table_async(self, coordinate, radius=None,
Can be either the name of an object or a coordinate string
If a name, must be resolvable by NED, SIMBAD, 2MASS, or SWAS.
Examples of acceptable coordinate strings, can be found `here.
<http://irsa.ipac.caltech.edu/applications/DUST/docs/coordinate.html>`_
<https://irsa.ipac.caltech.edu/applications/DUST/docs/coordinate.html>`_
radius : str, optional
The size of the region to include in the dust query, in radian,
degree or hour as per format specified by
Expand Down Expand Up @@ -271,7 +271,7 @@ def get_query_table(self, coordinate, radius=None,
Can be either the name of an object or a coordinate string
If a name, must be resolvable by NED, SIMBAD, 2MASS, or SWAS.
Examples of acceptable coordinate strings, can be found `here.
<http://irsa.ipac.caltech.edu/applications/DUST/docs/coordinate.html>`_
<https://irsa.ipac.caltech.edu/applications/DUST/docs/coordinate.html>`_
radius : str / `~astropy.units.Quantity`, optional
The size of the region to include in the dust query, in radian,
degree or hour as per format specified by
Expand Down Expand Up @@ -319,7 +319,7 @@ def _args_to_payload(self, coordinate, radius=None):
Can be either the name of an object or a coordinate string
If a name, must be resolvable by NED, SIMBAD, 2MASS, or SWAS.
Examples of acceptable coordinate strings, can be found `here
<http://irsa.ipac.caltech.edu/applications/DUST/docs/coordinate.html>`_
<https://irsa.ipac.caltech.edu/applications/DUST/docs/coordinate.html>`_
radius : str / `~astropy.units.Quantity`, optional
The size of the region to include in the dust query, in radian,
degree or hour as per format specified by
Expand Down
18 changes: 11 additions & 7 deletions astroquery/irsa_dust/tests/test_irsa_dust.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ def data(self, filename):
data_dir = os.path.join(os.path.dirname(__file__), 'data')
return os.path.join(data_dir, filename)

def read_data(self, filename):
with open(self.data(filename), "r") as f:
return f.read()


class TestDust(DustTestCase):

Expand All @@ -102,12 +106,12 @@ def test_parse_units(self):
assert expected_units == actual_units

def test_xml_ok(self):
data = open(self.data(M31_XML), "r").read()
data = self.read_data(M31_XML)
xml_tree = irsa_dust.utils.xml(data)
assert xml_tree is not None

def test_xml_err(self):
data = open(self.data(ERR_XML), "r").read()
data = self.read_data(ERR_XML)
with pytest.raises(Exception):
irsa_dust.utils.xml(data)

Expand Down Expand Up @@ -182,13 +186,13 @@ def test_args_to_payload_class_3(self, radius, patch_fromname):
('temperature', M31_URL_T),
])
def test_extract_image_urls_instance(self, image_type, expected_urls):
raw_xml = open(self.data(M31_XML), "r").read()
raw_xml = self.read_data(M31_XML)
url_list = IrsaDust().extract_image_urls(
raw_xml, image_type=image_type)
assert url_list == expected_urls

def test_extract_image_urls_instance__err(self):
raw_xml = open(self.data(M31_XML), "r").read()
raw_xml = self.read_data(M31_XML)
with pytest.raises(ValueError):
IrsaDust().extract_image_urls(
raw_xml, image_type="l")
Expand All @@ -200,13 +204,13 @@ def test_extract_image_urls_instance__err(self):
('temperature', M31_URL_T),
])
def test_extract_image_urls_class(self, image_type, expected_urls):
raw_xml = open(self.data(M31_XML), "r").read()
raw_xml = self.read_data(M31_XML)
url_list = IrsaDust.extract_image_urls(
raw_xml, image_type=image_type)
assert url_list == expected_urls

def test_extract_image_urls_class__err(self):
raw_xml = open(self.data(M31_XML), "r").read()
raw_xml = self.read_data(M31_XML)
with pytest.raises(ValueError):
IrsaDust.extract_image_urls(raw_xml, image_type="l")

Expand Down Expand Up @@ -330,7 +334,7 @@ def test_list_image_types_instance(self):

def send_request_mockreturn(self, method, url, data, timeout):
class MockResponse:
text = open(self.data(M31_XML), "r").read()
text = self.read_data(M31_XML)
return MockResponse

def get_ext_table_async_mockreturn(self, coordinate, radius=None,
Expand Down