@@ -708,21 +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 )
714+ check_filename = self ._request ('HEAD' , file_link , auth = auth )
715715 check_filename .raise_for_status ()
716716 except requests .HTTPError as ex :
717717 if ex .response .status_code == 401 :
718718 if skip_unauthorized :
719719 log .info ("Access denied to {url}. Skipping to"
720- " next file" .format (url = fileLink ))
720+ " next file" .format (url = file_link ))
721721 continue
722722 else :
723723 raise (ex )
724724
725- if 'text/html' in check_filename .headers [ 'Content-Type' ] :
725+ if 'text/html' in check_filename .headers . get ( 'Content-Type' , '' ) :
726726 raise ValueError ("Bad query. This can happen if you "
727727 "attempt to download proprietary "
728728 "data when not logged in" )
@@ -731,7 +731,7 @@ def download_files(self, files, savedir=None, cache=True,
731731 filename = re .search ("filename=(.*)" ,
732732 check_filename .headers ['Content-Disposition' ]).groups ()[0 ]
733733 except KeyError :
734- log .info (f"Unable to find filename for { fileLink } "
734+ log .info (f"Unable to find filename for { file_link } "
735735 "(missing Content-Disposition in header). "
736736 "Skipping to next file." )
737737 continue
@@ -741,7 +741,7 @@ def download_files(self, files, savedir=None, cache=True,
741741 filename )
742742
743743 try :
744- self ._download_file (fileLink ,
744+ self ._download_file (file_link ,
745745 filename ,
746746 timeout = self .TIMEOUT ,
747747 auth = auth ,
@@ -755,22 +755,22 @@ def download_files(self, files, savedir=None, cache=True,
755755 if ex .response .status_code == 401 :
756756 if skip_unauthorized :
757757 log .info ("Access denied to {url}. Skipping to"
758- " next file" .format (url = fileLink ))
758+ " next file" .format (url = file_link ))
759759 continue
760760 else :
761761 raise (ex )
762762 elif ex .response .status_code == 403 :
763- log .error ("Access denied to {url}" .format (url = fileLink ))
764- 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 :
765765 log .error ("The URL may be incorrect. Try using "
766766 "{0} instead of {1}"
767- .format (fileLink .replace ('dataPortal/' ,
768- 'dataPortal/sso/' ),
769- fileLink ))
767+ .format (file_link .replace ('dataPortal/' ,
768+ 'dataPortal/sso/' ),
769+ file_link ))
770770 raise ex
771771 elif ex .response .status_code == 500 :
772772 # empirically, this works the second time most of the time...
773- self ._download_file (fileLink ,
773+ self ._download_file (file_link ,
774774 filename ,
775775 timeout = self .TIMEOUT ,
776776 auth = auth ,
0 commit comments