Skip to content

Commit 9571482

Browse files
committed
re-indent head_safe block, add a copy to the other section
1 parent 8084f93 commit 9571482

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

astroquery/query.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,11 @@ def _download_file(self, url, local_filepath, timeout=None, auth=None,
443443
return
444444
elif existing_file_length == 0:
445445
open_mode = 'wb'
446+
if head_safe:
447+
response = self._session.request(method, url,
448+
timeout=timeout, stream=True,
449+
auth=auth, **kwargs)
450+
response.raise_for_status()
446451
else:
447452
log.info("Continuing download of file {0}, with {1} bytes to "
448453
"go ({2}%)".format(local_filepath,
@@ -479,11 +484,11 @@ def _download_file(self, url, local_filepath, timeout=None, auth=None,
479484
return
480485
else:
481486
open_mode = 'wb'
482-
if head_safe:
483-
response = self._session.request(method, url,
484-
timeout=timeout, stream=True,
485-
auth=auth, **kwargs)
486-
response.raise_for_status()
487+
if head_safe:
488+
response = self._session.request(method, url,
489+
timeout=timeout, stream=True,
490+
auth=auth, **kwargs)
491+
response.raise_for_status()
487492

488493
blocksize = astropy.utils.data.conf.download_block_size
489494

0 commit comments

Comments
 (0)