110110 },
111111 'Energy' : {
112112 'Frequency (GHz)' : ['frequency' , 'frequency' , _gen_numeric_sql ],
113- 'Bandwidth (GHz )' : ['bandwidth' , 'bandwidth' , _gen_numeric_sql ],
113+ 'Bandwidth (Hz )' : ['bandwidth' , 'bandwidth' , _gen_numeric_sql ],
114114 'Spectral resolution (KHz)' : ['spectral_resolution' ,
115115 'em_resolution' , _gen_spec_res_sql ],
116116 'Band' : ['band_list' , 'band_list' , _gen_band_list_sql ]
@@ -677,7 +677,7 @@ def _HEADER_data_size(self, files):
677677 return data_sizes , totalsize .to (u .GB )
678678
679679 def download_files (self , files , savedir = None , cache = True ,
680- continuation = True , skip_unauthorized = True ):
680+ continuation = True , skip_unauthorized = True , ):
681681 """
682682 Given a list of file URLs, download them
683683
@@ -708,22 +708,21 @@ def download_files(self, files, savedir=None, cache=True,
708708 downloaded_files = []
709709 if savedir is None :
710710 savedir = self .cache_location
711- for fileLink in unique (files ):
712- log .debug ("Downloading {0} to {1}" .format (fileLink , savedir ))
711+ for file_link in unique (files ):
712+ log .debug ("Downloading {0} to {1}" .format (file_link , savedir ))
713713 try :
714- check_filename = self ._request ('HEAD' , fileLink , auth = auth ,
715- stream = True )
714+ check_filename = self ._request ('HEAD' , file_link , auth = auth )
716715 check_filename .raise_for_status ()
717716 except requests .HTTPError as ex :
718717 if ex .response .status_code == 401 :
719718 if skip_unauthorized :
720719 log .info ("Access denied to {url}. Skipping to"
721- " next file" .format (url = fileLink ))
720+ " next file" .format (url = file_link ))
722721 continue
723722 else :
724723 raise (ex )
725724
726- if 'text/html' in check_filename .headers [ 'Content-Type' ] :
725+ if 'text/html' in check_filename .headers . get ( 'Content-Type' , '' ) :
727726 raise ValueError ("Bad query. This can happen if you "
728727 "attempt to download proprietary "
729728 "data when not logged in" )
@@ -732,7 +731,7 @@ def download_files(self, files, savedir=None, cache=True,
732731 filename = re .search ("filename=(.*)" ,
733732 check_filename .headers ['Content-Disposition' ]).groups ()[0 ]
734733 except KeyError :
735- log .info (f"Unable to find filename for { fileLink } "
734+ log .info (f"Unable to find filename for { file_link } "
736735 "(missing Content-Disposition in header). "
737736 "Skipping to next file." )
738737 continue
@@ -742,42 +741,42 @@ def download_files(self, files, savedir=None, cache=True,
742741 filename )
743742
744743 try :
745- self ._download_file (fileLink ,
744+ self ._download_file (file_link ,
746745 filename ,
747746 timeout = self .TIMEOUT ,
748747 auth = auth ,
749748 cache = cache ,
750749 method = 'GET' ,
751- head_safe = True ,
750+ head_safe = False ,
752751 continuation = continuation )
753752
754753 downloaded_files .append (filename )
755754 except requests .HTTPError as ex :
756755 if ex .response .status_code == 401 :
757756 if skip_unauthorized :
758757 log .info ("Access denied to {url}. Skipping to"
759- " next file" .format (url = fileLink ))
758+ " next file" .format (url = file_link ))
760759 continue
761760 else :
762761 raise (ex )
763762 elif ex .response .status_code == 403 :
764- log .error ("Access denied to {url}" .format (url = fileLink ))
765- if 'dataPortal' in fileLink and 'sso' not in fileLink :
763+ log .error ("Access denied to {url}" .format (url = file_link ))
764+ if 'dataPortal' in file_link and 'sso' not in file_link :
766765 log .error ("The URL may be incorrect. Try using "
767766 "{0} instead of {1}"
768- .format (fileLink .replace ('dataPortal/' ,
769- 'dataPortal/sso/' ),
770- fileLink ))
767+ .format (file_link .replace ('dataPortal/' ,
768+ 'dataPortal/sso/' ),
769+ file_link ))
771770 raise ex
772771 elif ex .response .status_code == 500 :
773772 # empirically, this works the second time most of the time...
774- self ._download_file (fileLink ,
773+ self ._download_file (file_link ,
775774 filename ,
776775 timeout = self .TIMEOUT ,
777776 auth = auth ,
778777 cache = cache ,
779778 method = 'GET' ,
780- head_safe = True ,
779+ head_safe = False ,
781780 continuation = continuation )
782781
783782 downloaded_files .append (filename )
@@ -1107,7 +1106,7 @@ def download_and_extract_files(self, urls, delete=True, regex=r'.*\.fits$',
11071106 expanded_files += [x for x in files ['access_url' ] if
11081107 filere .match (x .split ('/' )[- 1 ])]
11091108 else :
1110- tar_files .append (tar_file )
1109+ tar_files .append (url )
11111110
11121111 try :
11131112 # get the tar files
0 commit comments