Skip to content

Commit bd34224

Browse files
committed
corrected docs/nasa_ads/nasa_ads.rst code block
1 parent 9f3e83c commit bd34224

File tree

3 files changed

+19
-17
lines changed

3 files changed

+19
-17
lines changed

astroquery/nasa_ads/core.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ def query_simple(self, query_string, get_query_payload=False, get_raw_response=F
6161
#~ response_bfs = self._parse_response_to_bfs(response)
6262
#
6363
#self._parse_bfs_to_table(response_bfs)
64-
resulttable = self._parse_response(response)
64+
resulttable = self._parse_response(response.encode(results.encoding).decode('utf-8'))
6565

66-
return resulttable
66+
return resulttable
6767

6868
def _parse_response(self, response):
69-
xmlrepr = minidom.parseString(response.text.encode('utf-8'))
69+
xmlrepr = minidom.parseString(response.text)
7070
# Check if there are any results!
7171

7272
# get the list of hits

astroquery/nasa_ads/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ def get_data_from_xml(doclist, fieldname, nohitreturn=None):
1010
fields = [nohitreturn]
1111
fields = []
1212
for field in fieldlist: # this is useful for e.g. author field
13-
fields.append(field.childNodes[0].data.encode("utf-8"))
13+
#~ fields.append(field.childNodes[0].data.decode("utf-8"))
14+
fields.append(field.childNodes[0].data)
1415
result.append(fields)
1516
return result

docs/nasa_ads/nasa_ads.rst

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,22 @@ Examples
1818

1919
Search works by specific identifier
2020
-----------------------------------
21+
.. code-block:: python
2122
22-
from astroquery import nasa_ads as na
23-
# the "^" makes ADS to return only papers where Persson
24-
# is first author
25-
results = na.ADS.query_simple('^Persson Origin of water\
23+
from astroquery import nasa_ads as na
24+
# the "^" makes ADS to return only papers where Persson
25+
# is first author
26+
results = na.ADS.query_simple('^Persson Origin of water\
2627
around deeply embedded low-mass protostars') results[0].title
27-
28-
# to sort after publication date
29-
results.sort(['pubdate'])
30-
31-
# get the title of the last hit
32-
title = results[-1]['title'][0]
33-
34-
# printout the authors of the last hit
35-
print results[-1]['authors']
28+
29+
# to sort after publication date
30+
results.sort(['pubdate'])
31+
32+
# get the title of the last hit
33+
title = results[-1]['title'][0]
34+
35+
# printout the authors of the last hit
36+
print results[-1]['authors']
3637
3738
3839
Get links

0 commit comments

Comments
 (0)