Skip to content

Commit d78018a

Browse files
author
“Javier
committed
Client_id for file download requests
1 parent 654b84c commit d78018a

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

astroquery/esa/hubble/core.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,10 @@ def download_product(self, observation_id, *, calibration_level=None,
9292
None. It downloads the observation indicated
9393
"""
9494

95-
params = {"OBSERVATION_ID": observation_id}
95+
params = {"OBSERVATION_ID": observation_id,
96+
"USERNAME": "ehst-astroquery"}
9697
url = self.data_url + "?OBSERVATION_ID=" + observation_id
98+
url += "&USERNAME=" + "ehst-astroquery"
9799

98100
if filename is None:
99101
filename = observation_id + ".tar"
@@ -154,14 +156,15 @@ def get_artifact(self, artifact_id, filename=None, verbose=False):
154156
None. It downloads the artifact indicated
155157
"""
156158

157-
params = {"ARTIFACT_ID": artifact_id}
159+
params = {"ARTIFACT_ID": artifact_id, "USERNAME": "ehst-astroquery"}
158160
response = self._request('GET', self.data_url, save=True, cache=True,
159161
params=params)
160162
if filename is None:
161163
filename = artifact_id
162164

163165
if verbose:
164-
log.info(self.data_url + "?ARTIFACT_ID=" + artifact_id)
166+
log.info(self.data_url + "?ARTIFACT_ID=" + artifact_id +
167+
"&USERNAME=ehst-astroquery")
165168
log.info(self.copying_string.format(filename))
166169

167170
shutil.move(response, filename)
@@ -200,7 +203,8 @@ def get_postcard(self, observation_id, calibration_level="RAW",
200203
params = {"RETRIEVAL_TYPE": "POSTCARD",
201204
"OBSERVATION_ID": observation_id,
202205
"CALIBRATION_LEVEL": calibration_level,
203-
"RESOLUTION": resolution}
206+
"RESOLUTION": resolution,
207+
"USERNAME": "ehst-astroquery"}
204208

205209
response = self._request('GET', self.data_url, save=True, cache=True,
206210
params=params)
@@ -213,7 +217,8 @@ def get_postcard(self, observation_id, calibration_level="RAW",
213217
"&".join(["?RETRIEVAL_TYPE=POSTCARD",
214218
"OBSERVATION_ID=" + observation_id,
215219
"CALIBRATION_LEVEL=" + calibration_level,
216-
"RESOLUTION=" + str(resolution)]))
220+
"RESOLUTION=" + str(resolution),
221+
"USERNAME=ehst-astroquery"]))
217222
log.info(self.copying_string.format(filename))
218223

219224
shutil.move(response, filename)
@@ -435,6 +440,7 @@ def query_target(self, name, filename=None, output_format='votable',
435440
"""
436441

437442
params = {"RESOURCE_CLASS": "OBSERVATION",
443+
"USERNAME": "ehst-astroquery",
438444
"SELECTED_FIELDS": "OBSERVATION",
439445
"QUERY": "(TARGET.TARGET_NAME=='" + name + "')",
440446
"RETURN_TYPE": str(output_format)}
@@ -445,7 +451,8 @@ def query_target(self, name, filename=None, output_format='votable',
445451
if verbose:
446452
log.info(self.metadata_url + "?RESOURCE_CLASS=OBSERVATION&"
447453
"SELECTED_FIELDS=OBSERVATION&QUERY=(TARGET.TARGET_NAME"
448-
"=='" + name + "')&RETURN_TYPE=" + str(output_format))
454+
"=='" + name + "')&USERNAME=ehst-astroquery&"
455+
"RETURN_TYPE=" + str(output_format))
449456
log.info(self.copying_string.format(filename))
450457
if filename is None:
451458
filename = "target.xml"

0 commit comments

Comments
 (0)