14
14
from astropy .io import ascii
15
15
from astropy .time import Time
16
16
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
18
18
19
19
# 3. local imports - use relative imports
20
20
# commonly required local imports shown below as example
@@ -36,6 +36,12 @@ class HorizonsClass(BaseQuery):
36
36
37
37
TIMEOUT = conf .timeout
38
38
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
+
39
45
def __init__ (self , id = None , location = None , epochs = None ,
40
46
id_type = None ):
41
47
"""
@@ -137,7 +143,7 @@ def __init__(self, id=None, location=None, epochs=None,
137
143
self .query_type = None # ['ephemerides', 'elements', 'vectors']
138
144
139
145
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
141
147
142
148
def __str__ (self ):
143
149
"""
@@ -1148,13 +1154,13 @@ def _parse_result(self, response, verbose=None):
1148
1154
pass
1149
1155
raise
1150
1156
1151
- self .raw_response = response .text
1157
+ self ._raw_response = response .text
1152
1158
1153
1159
# return raw response, if desired
1154
1160
if self .return_raw :
1155
1161
# reset return_raw flag
1156
1162
self .return_raw = False
1157
- return self .raw_response
1163
+ return self ._raw_response
1158
1164
1159
1165
# split response by line break
1160
1166
src = response .text .split ('\n ' )
@@ -1264,7 +1270,7 @@ def _parse_result(self, response, verbose=None):
1264
1270
else :
1265
1271
raise ValueError (('Query failed without known error message; '
1266
1272
'received the following response:\n '
1267
- '{}' ).format (self . raw_response ))
1273
+ '{}' ).format (response . text ))
1268
1274
# strip whitespaces from column labels
1269
1275
headerline = [h .strip () for h in headerline ]
1270
1276
0 commit comments