Skip to content

Commit dab2b98

Browse files
Changed log levels if proprietary data
1 parent 9c60c56 commit dab2b98

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

astroquery/esa/xmm_newton/core.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,18 +102,11 @@ def download_data(self, observation_id, *, filename=None, verbose=False,
102102
file format, optional, by default all formats
103103
values: ASC, ASZ, FTZ, HTM, IND, PDF, PNG
104104
105-
106105
Returns
107106
-------
108107
None if not verbose. It downloads the observation indicated
109108
If verbose returns the filename
110109
"""
111-
"""
112-
Here we change the log level so that it is above 20, this is to stop a log.debug in query.py. this debug
113-
reveals the url being sent which in turn reveals the users username and password
114-
"""
115-
previouslevel = log.getEffectiveLevel()
116-
log.setLevel(21)
117110

118111
# create url to access the aio
119112
link = self._create_link(observation_id, **kwargs)
@@ -134,11 +127,20 @@ def download_data(self, observation_id, *, filename=None, verbose=False,
134127
# get desired filename
135128
filename = self._create_filename(filename, observation_id, suffixes)
136129

137-
self._download_file(link, filename, head_safe=True, cache=cache)
130+
if prop:
131+
"""
132+
Here we change the log level so that it is above 20, this is to stop a log.debug (line 431) in query.py.
133+
This debug reveals the url being sent which in turn reveals the users username and password
134+
"""
135+
previouslevel = log.getEffectiveLevel()
136+
log.setLevel(21)
137+
self._download_file(link, filename, head_safe=True, cache=cache)
138+
log.setLevel(previouslevel)
139+
else:
140+
self._download_file(link, filename, head_safe=True, cache=cache)
138141

139142
if verbose:
140143
log.info(f"Wrote {link} to {filename}")
141-
log.setLevel(previouslevel)
142144

143145
def get_postcard(self, observation_id, *, image_type="OBS_EPIC",
144146
filename=None, verbose=False):

0 commit comments

Comments
 (0)