Skip to content

Commit ebdf195

Browse files
committedFeb 5, 2019
expand documentation in query.py
1 parent d7af824 commit ebdf195

File tree

1 file changed

+27
-6
lines changed

1 file changed

+27
-6
lines changed
 

‎astroquery/query.py

+27-6
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,9 @@ def _request(self, method, url, params=None, data=None, headers=None,
171171
but with added caching-related tools
172172
173173
This is a low-level method not generally intended for use by astroquery
174-
end-users.
174+
end-users. However, it should _always_ be used by astroquery
175+
developers; direct uses of `urllib` or `requests` are almost never
176+
correct.
175177
176178
Parameters
177179
----------
@@ -194,7 +196,12 @@ def _request(self, method, url, params=None, data=None, headers=None,
194196
timeout : int
195197
cache : bool
196198
verify : bool
199+
Verify the server's TLS certificate?
200+
(see http://docs.python-requests.org/en/master/_modules/requests/sessions/?highlight=verify)
197201
continuation : bool
202+
If the file is partly downloaded to the target location, this
203+
parameter will try to continue the download where it left off.
204+
See `_download_file`.
198205
stream : bool
199206
200207
Returns
@@ -219,10 +226,9 @@ def _request(self, method, url, params=None, data=None, headers=None,
219226
# ":" so replace them with an underscore
220227
local_filename = local_filename.replace(':', '_')
221228
local_filepath = os.path.join(self.cache_location or savedir or '.', local_filename)
222-
# REDUNDANT: spinner has this log.info("Downloading
223-
# {0}...".format(local_filename))
224-
self._download_file(url, local_filepath, cache=cache, continuation=continuation, method=method, auth=auth,
225-
**req_kwargs)
229+
self._download_file(url, local_filepath, cache=cache,
230+
continuation=continuation, method=method,
231+
auth=auth, **req_kwargs)
226232
return local_filepath
227233
else:
228234
query = AstroQuery(method, url, **req_kwargs)
@@ -243,10 +249,25 @@ def _request(self, method, url, params=None, data=None, headers=None,
243249
return response
244250

245251
def _download_file(self, url, local_filepath, timeout=None, auth=None,
246-
continuation=True, cache=False, method="GET", head_safe=False, **kwargs):
252+
continuation=True, cache=False, method="GET",
253+
head_safe=False, **kwargs):
247254
"""
248255
Download a file. Resembles `astropy.utils.data.download_file` but uses
249256
the local ``_session``
257+
258+
Parameters
259+
----------
260+
url : string
261+
local_filepath : string
262+
timeout : int
263+
auth : dict or None
264+
continuation : bool
265+
If the file has already been partially downloaded *and* the server
266+
supports HTTP "range" requests, the download will be continued
267+
where it left off.
268+
cache : bool
269+
method : "GET" or "POST"
270+
head_safe : bool
250271
"""
251272

252273
if head_safe:

0 commit comments

Comments
 (0)
Please sign in to comment.