Skip to content

Commit 0d0c55a

Browse files
committed
implement requested changes
1 parent 92080aa commit 0d0c55a

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

CHANGES.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ esa.xmm_newton
1515

1616
- Adding the extraction epic light curves. [#2017]
1717
- Adding the extraction of epic spectra. [#2017]
18+
- Use astroquery downloader tool to get progressbar, caching, and prevent
19+
memory leaks [#2087]
1820

1921
Service fixes and enhancements
2022
------------------------------

astroquery/esa/xmm_newton/core.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def __init__(self, tap_handler=None):
4747
self._rmf_ftp = str("http://sasdev-xmm.esac.esa.int/pub/ccf/constituents/extras/responses/")
4848

4949
def download_data(self, observation_id, *, filename=None, verbose=False,
50-
**kwargs):
50+
cache=True, **kwargs):
5151
"""
5252
Download data from XMM-Newton
5353
@@ -110,7 +110,9 @@ def download_data(self, observation_id, *, filename=None, verbose=False,
110110
if verbose:
111111
log.info(link)
112112

113-
response = self._request('HEAD', link, save=False, cache=False)
113+
# we can cache this HEAD request - the _download_file one will check
114+
# the file size and will never cache
115+
response = self._request('HEAD', link, save=False, cache=cache)
114116

115117
# Get original extension
116118
_, params = cgi.parse_header(response.headers['Content-Disposition'])
@@ -122,7 +124,7 @@ def download_data(self, observation_id, *, filename=None, verbose=False,
122124

123125
filename += "".join(suffixes)
124126

125-
self._download_file(link, filename, head_safe=True)
127+
self._download_file(link, filename, head_safe=True, cache=cache)
126128

127129
if verbose:
128130
log.info("Wrote {0} to {1}".format(link, filename))

0 commit comments

Comments
 (0)