Skip to content

Commit 2891f56

Browse files
Fix misconfigured option 3 in datagateway_admin
1 parent c2c67f6 commit 2891f56

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

tools/datagateway_admin

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -157,14 +157,15 @@ def list_file_locations():
157157

158158
def prepare_download():
159159
for download_id in input_download_ids():
160-
requests.post(
160+
response = requests.put(
161161
f"{topcat_url}/admin/download/{download_id}/prepare",
162-
params={
162+
data={
163163
"facilityName": facility_name,
164164
"sessionId": session_id,
165165
},
166166
verify=verifySsl,
167167
)
168+
print(response.status_code, response.text)
168169

169170

170171
def expire_download():
@@ -173,7 +174,7 @@ def expire_download():
173174

174175

175176
def _expire_download(download_id):
176-
requests.put(
177+
response = requests.put(
177178
topcat_url + "/admin/download/" + download_id + "/status",
178179
data={
179180
"facilityName": facility_name,
@@ -182,6 +183,7 @@ def _expire_download(download_id):
182183
},
183184
verify=verifySsl,
184185
)
186+
print(response.status_code, response.text)
185187

186188

187189
def expire_all_pending_downloads():
@@ -194,12 +196,8 @@ def expire_all_pending_downloads():
194196
"sessionId": session_id,
195197
"queryOffset": query
196198
}, verify=verifySsl).text)
197-
for download in downloads:
198-
requests.put(topcat_url + "/admin/download/" + str(download["id"]) + "/status", data={
199-
"facilityName": facility_name,
200-
"sessionId": session_id,
201-
"value": "EXPIRED"
202-
}, verify=verifySsl)
199+
for download in downloads:
200+
_expire_download(download_id=download["id"])
203201

204202
def manage_download_types():
205203
download_types = list(settingsJson["accessMethods"])
@@ -337,14 +335,15 @@ def get_all_queued_downloads():
337335
return requests.get(topcat_url + "/admin/downloads", params=params, verify=verifySsl).text
338336

339337

340-
def prepare_download(download_id):
338+
def start_download(download_id):
341339
data = {
342340
"facilityName": facility_name,
343341
"sessionId": session_id,
344342
"value": "PREPARING"
345343
}
346344
url = topcat_url + "/admin/download/" + download_id + "/status"
347-
requests.put(url=url, data=data, verify=verifySsl)
345+
response = requests.put(url=url, data=data, verify=verifySsl)
346+
print(response.status_code, response.text)
348347

349348

350349
def show_all_queued_downloads():
@@ -353,14 +352,14 @@ def show_all_queued_downloads():
353352

354353
def start_queued_download():
355354
for download_id in input_download_ids():
356-
prepare_download(download_id=download_id)
355+
start_download(download_id=download_id)
357356

358357

359358
def start_queued_downloads():
360359
text = get_all_queued_downloads()
361360
downloads = json.loads(text)
362-
for download in downloads:
363-
prepare_download(str(download["id"]))
361+
for download in downloads:
362+
start_download(str(download["id"]))
364363

365364

366365
def requeue_download():
@@ -371,7 +370,8 @@ def requeue_download():
371370
"value": "QUEUED"
372371
}
373372
url = topcat_url + "/admin/download/" + download_id + "/status"
374-
requests.put(url=url, data=data, verify=verifySsl)
373+
response = requests.put(url=url, data=data, verify=verifySsl)
374+
print(response.status_code, response.text)
375375

376376

377377
def expire_all_queued_downloads():

0 commit comments

Comments
 (0)