@@ -79,16 +79,18 @@ def _generate_payload(self, input=None):
7979 url = urlparse .urljoin (self .URL , form .get ('action' ))
8080 return url , payload
8181
82- def _submit_form (self , input = None , cache = True ):
82+ def _submit_form (self , input = None , cache = True , get_query_payload = False ):
8383 url , payload = self ._generate_payload (input = input )
84+ if get_query_payload :
85+ return payload
8486 response = self ._request ('GET' , url , params = payload , cache = cache )
8587 response .raise_for_status ()
8688 return response
8789
8890 def get_images (self , position , survey , * , coordinates = None , projection = None ,
8991 pixels = None , scaling = None , sampler = None , resolver = None ,
9092 deedger = None , radius = None , height = None , width = None , cache = True ,
91- show_progress = True ):
93+ show_progress = True , get_query_payload = False ):
9294 """
9395 Query the SkyView service, download the FITS file that will be
9496 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,
197199 projection = projection , pixels = pixels , scaling = scaling ,
198200 sampler = sampler , resolver = resolver , deedger = deedger ,
199201 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
201206 return [obj .get_fits () for obj in readable_objects ]
202207
203208 @prepend_docstr_nosections (get_images .__doc__ )
204209 def get_images_async (self , position , survey , * , coordinates = None ,
205210 projection = None , pixels = None , scaling = None ,
206211 sampler = None , resolver = None , deedger = None ,
207212 radius = None , height = None , width = None ,
208- cache = True , show_progress = True ):
213+ cache = True , show_progress = True , get_query_payload = False ):
209214 """
210215 Returns
211216 -------
@@ -214,16 +219,19 @@ def get_images_async(self, position, survey, *, coordinates=None,
214219 image_urls = self .get_image_list (position , survey , coordinates = coordinates ,
215220 projection = projection , pixels = pixels , scaling = scaling , sampler = sampler ,
216221 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 )
220227 for url in image_urls ]
221228
222229 @prepend_docstr_nosections (get_images .__doc__ , sections = ['Returns' , 'Examples' ])
223230 def get_image_list (self , position , survey , * , coordinates = None ,
224231 projection = None , pixels = None , scaling = None ,
225232 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 ):
227235 """
228236 Returns
229237 -------
@@ -263,7 +271,9 @@ def get_image_list(self, position, survey, *, coordinates=None,
263271 'imscale' : size_deg ,
264272 'size' : size_deg ,
265273 '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
267277 urls = self ._parse_response (response )
268278 return urls
269279
0 commit comments