@@ -79,16 +79,18 @@ def _generate_payload(self, input=None):
79
79
url = urlparse .urljoin (self .URL , form .get ('action' ))
80
80
return url , payload
81
81
82
- def _submit_form (self , input = None , cache = True ):
82
+ def _submit_form (self , input = None , cache = True , get_query_payload = False ):
83
83
url , payload = self ._generate_payload (input = input )
84
+ if get_query_payload :
85
+ return payload
84
86
response = self ._request ('GET' , url , params = payload , cache = cache )
85
87
response .raise_for_status ()
86
88
return response
87
89
88
90
def get_images (self , position , survey , * , coordinates = None , projection = None ,
89
91
pixels = None , scaling = None , sampler = None , resolver = None ,
90
92
deedger = None , radius = None , height = None , width = None , cache = True ,
91
- show_progress = True ):
93
+ show_progress = True , get_query_payload = False ):
92
94
"""
93
95
Query the SkyView service, download the FITS file that will be
94
96
found and return a generator over the local paths to the
@@ -197,15 +199,18 @@ def get_images(self, position, survey, *, coordinates=None, projection=None,
197
199
projection = projection , pixels = pixels , scaling = scaling ,
198
200
sampler = sampler , resolver = resolver , deedger = deedger ,
199
201
radius = radius , height = height , width = width ,
200
- cache = cache , show_progress = show_progress )
202
+ cache = cache , show_progress = show_progress ,
203
+ get_query_payload = get_query_payload )
204
+ if get_query_payload :
205
+ return readable_objects
201
206
return [obj .get_fits () for obj in readable_objects ]
202
207
203
208
@prepend_docstr_nosections (get_images .__doc__ )
204
209
def get_images_async (self , position , survey , * , coordinates = None ,
205
210
projection = None , pixels = None , scaling = None ,
206
211
sampler = None , resolver = None , deedger = None ,
207
212
radius = None , height = None , width = None ,
208
- cache = True , show_progress = True ):
213
+ cache = True , show_progress = True , get_query_payload = False ):
209
214
"""
210
215
Returns
211
216
-------
@@ -214,16 +219,19 @@ def get_images_async(self, position, survey, *, coordinates=None,
214
219
image_urls = self .get_image_list (position , survey , coordinates = coordinates ,
215
220
projection = projection , pixels = pixels , scaling = scaling , sampler = sampler ,
216
221
resolver = resolver , deedger = deedger , radius = radius ,
217
- height = height , width = width , cache = cache )
218
- return [commons .FileContainer (url , encoding = 'binary' ,
219
- show_progress = show_progress )
222
+ height = height , width = width , cache = cache ,
223
+ get_query_payload = get_query_payload )
224
+ if get_query_payload :
225
+ return image_urls
226
+ return [commons .FileContainer (url , encoding = 'binary' , show_progress = show_progress )
220
227
for url in image_urls ]
221
228
222
229
@prepend_docstr_nosections (get_images .__doc__ , sections = ['Returns' , 'Examples' ])
223
230
def get_image_list (self , position , survey , * , coordinates = None ,
224
231
projection = None , pixels = None , scaling = None ,
225
232
sampler = None , resolver = None , deedger = None ,
226
- radius = None , width = None , height = None , cache = True ):
233
+ radius = None , width = None , height = None , cache = True ,
234
+ get_query_payload = False ):
227
235
"""
228
236
Returns
229
237
-------
@@ -263,7 +271,9 @@ def get_image_list(self, position, survey, *, coordinates=None,
263
271
'imscale' : size_deg ,
264
272
'size' : size_deg ,
265
273
'pixels' : pixels }
266
- response = self ._submit_form (input , cache = cache )
274
+ response = self ._submit_form (input , cache = cache , get_query_payload = get_query_payload )
275
+ if get_query_payload :
276
+ return response
267
277
urls = self ._parse_response (response )
268
278
return urls
269
279
0 commit comments