Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGES
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
0.3.1.dev
---------

- None yet
- Fix NASA ADS, which had an internal syntax error (#602)

0.3.0 (2015-10-26)
------------------
Expand Down
20 changes: 14 additions & 6 deletions astroquery/nasa_ads/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,19 @@ class ADSClass(BaseQuery):

def __init__(self, *args):
""" set some parameters """
pass
super(ADSClass, self).__init__()

@class_or_instance
def query_simple(self, query_string, get_query_payload=False, get_raw_response=False):
self.query_string = query_string
def query_simple(self, query_string, get_query_payload=False,
get_raw_response=False, cache=True):
"""
Basic query. Uses a string and the ADS generic query.
"""
request_payload = self._args_to_payload(query_string)

response = commons.send_request(self.QUERY_SIMPLE_URL, request_payload, self.TIMEOUT)
response = self._request(method='POST', url=self.QUERY_SIMPLE_URL,
data=request_payload, timeout=self.TIMEOUT,
cache=cache)

# primarily for debug purposes, but also useful if you want to send
# someone a URL linking directly to the data
Expand All @@ -50,12 +55,15 @@ def query_simple(self, query_string, get_query_payload=False, get_raw_response=F
if get_raw_response:
return response
# parse the XML response into AstroPy Table
resulttable = self._parse_response(response.encode(results.encoding).decode('utf-8'))
resulttable = self._parse_response(response)

return resulttable

def _parse_response(self, response):
xmlrepr = minidom.parseString(response.text)

encoded_content = response.text.encode(response.encoding)

xmlrepr = minidom.parseString(encoded_content)
# Check if there are any results!

# get the list of hits
Expand Down