Skip to content

Commit 8154531

Browse files
committed
fix the wait-until-done step
1 parent e40f006 commit 8154531

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

astroquery/nrao/core.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -437,16 +437,16 @@ def _get_data(self, solr_id, email=None, workflow='runBasicMsWorkflow',
437437
if 'https://data.nrao.edu/rh/requests/' not in wait_url:
438438
raise ValueError(f"Got wrong URL from post request: {wait_url}")
439439

440-
not_done = True
441-
while not_done:
440+
# to get the right format of response, you need to specify this:
441+
# accept = {"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"}
442+
443+
while True:
442444
time.sleep(1)
443445
print(".", end='', flush=True)
444-
resp = self._request('GET', wait_url, cache=False)
446+
resp = self._request('GET', wait_url + "/state", cache=False)
445447
resp.raise_for_status()
446-
if 'INPROGRESS' in resp.text:
447-
continue
448-
elif 'REQUEST COMPLETED' in resp.text:
449-
not_done = False
448+
if resp.text == 'COMPLETE':
449+
break
450450

451451
return resp
452452

0 commit comments

Comments
 (0)