Skip to content

Commit 96e0bc4

Browse files
committed
Deprecate raw_response property.
1 parent 628f673 commit 96e0bc4

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

astroquery/jplhorizons/core.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from astropy.io import ascii
1515
from astropy.time import Time
1616
from astropy.utils.exceptions import AstropyDeprecationWarning
17-
from astropy.utils.decorators import deprecated_renamed_argument
17+
from astropy.utils.decorators import deprecated_renamed_argument, deprecated_attribute
1818

1919
# 3. local imports - use relative imports
2020
# commonly required local imports shown below as example
@@ -36,6 +36,12 @@ class HorizonsClass(BaseQuery):
3636

3737
TIMEOUT = conf.timeout
3838

39+
raw_response = deprecated_attribute(
40+
'raw_response', '0.4.7',
41+
alternative=("an `_async` method (e.g., `ephemerides_async`) to "
42+
"return a response object, and access the content with "
43+
"`response.text`"))
44+
3945
def __init__(self, id=None, location=None, epochs=None,
4046
id_type=None):
4147
"""
@@ -137,7 +143,7 @@ def __init__(self, id=None, location=None, epochs=None,
137143
self.query_type = None # ['ephemerides', 'elements', 'vectors']
138144

139145
self.uri = None # will contain query URL
140-
self.raw_response = None # will contain raw response from server
146+
self._raw_response = None # will contain raw response from server
141147

142148
def __str__(self):
143149
"""
@@ -1148,13 +1154,13 @@ def _parse_result(self, response, verbose=None):
11481154
pass
11491155
raise
11501156

1151-
self.raw_response = response.text
1157+
self._raw_response = response.text
11521158

11531159
# return raw response, if desired
11541160
if self.return_raw:
11551161
# reset return_raw flag
11561162
self.return_raw = False
1157-
return self.raw_response
1163+
return self._raw_response
11581164

11591165
# split response by line break
11601166
src = response.text.split('\n')
@@ -1264,7 +1270,7 @@ def _parse_result(self, response, verbose=None):
12641270
else:
12651271
raise ValueError(('Query failed without known error message; '
12661272
'received the following response:\n'
1267-
'{}').format(self.raw_response))
1273+
'{}').format(response.text))
12681274
# strip whitespaces from column labels
12691275
headerline = [h.strip() for h in headerline]
12701276

0 commit comments

Comments
 (0)