Skip to content

Commit 3536435

Browse files
committed
fix the APEX query tool: allow queries on other parameters
1 parent 1dce7c8 commit 3536435

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

astroquery/eso/core.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -571,8 +571,8 @@ def verify_data_exists(self, dataset):
571571

572572
return 'No data returned' not in content
573573

574-
def query_apex_quicklooks(self, project_id, help=False, open_form=False,
575-
cache=True, **kwargs):
574+
def query_apex_quicklooks(self, project_id=None, help=False,
575+
open_form=False, cache=True, **kwargs):
576576
"""
577577
APEX data are distributed with quicklook products identified with a
578578
different name than other ESO products. This query tool searches by
@@ -593,7 +593,10 @@ def query_apex_quicklooks(self, project_id, help=False, open_form=False,
593593
return self._print_help(apex_query_url, 'apex')
594594
else:
595595

596-
payload = {'dp_id':project_id, 'wdbo':'csv/download'}
596+
payload = {'wdbo':'csv/download'}
597+
if project_id is not None:
598+
payload['dp_id'] = project_id
599+
payload.update(kwargs)
597600

598601
apex_form = self._request("GET", apex_query_url, cache=cache)
599602
apex_response = self._activate_form(apex_form, form_index=0,
@@ -602,16 +605,20 @@ def query_apex_quicklooks(self, project_id, help=False, open_form=False,
602605

603606
content = apex_response.content
604607
if _check_response(content):
608+
#First line is always garbage
609+
content = content.split(b'\n',1)[1]
605610
try:
606611
table = Table.read(BytesIO(content), format="ascii.csv",
607-
guess=False, header_start=1)
612+
guess=False,# header_start=1,
613+
comment="#")
608614
except Exception as ex:
609615
# astropy 0.3.2 raises an anonymous exception; this is
610616
# intended to prevent that from causing real problems
611617
if 'No reader defined' in ex.args[0]:
612618
table = Table.read(BytesIO(content), format="ascii",
613619
delimiter=',', guess=False,
614-
header_start=1)
620+
#header_start=1,
621+
comment="#")
615622
else:
616623
raise ex
617624
else:

0 commit comments

Comments
 (0)