comparison downloader_bank_hmdb.pl @ 2:be504ccbc41c draft default tip

master branch Updating with tag :CI_COMMIT_TAG - - Fxx
author fgiacomoni
date Wed, 30 Nov 2022 16:14:27 +0000
parents 7c9269bded0e
children
comparison
equal deleted inserted replaced
1:4373f936111d 2:be504ccbc41c
69 # get information from conf 69 # get information from conf
70 if ($CONF->{$bankName.'_URL'}) { 70 if ($CONF->{$bankName.'_URL'}) {
71 $bankUrl = $CONF->{$bankName.'_URL'} ; 71 $bankUrl = $CONF->{$bankName.'_URL'} ;
72 # get version of the http resource 72 # get version of the http resource
73 my $oUtils = utils->new() ; 73 my $oUtils = utils->new() ;
74 $oUtils->checkHttpUrl($bankUrl) ;
74 ($bankVersion) = $oUtils->getHttpFileVersion($bankUrl) ; 75 ($bankVersion) = $oUtils->getHttpFileVersion($bankUrl) ;
75 76
76 print "\tThe current version is: $bankVersion\n" if $VERBOSE > 1 ; 77 print "\tThe current version is: $bankVersion\n" if $VERBOSE > 1 ;
77 } 78 }
78 else { 79 else {
130 131
131 if (-d $bankFileDir) { 132 if (-d $bankFileDir) {
132 print "\tDownload of the asked bank ($bankName)...\n" if $VERBOSE > 1 ; 133 print "\tDownload of the asked bank ($bankName)...\n" if $VERBOSE > 1 ;
133 print "\tFrom...$bankUrl\n" if $VERBOSE > 1 ; 134 print "\tFrom...$bankUrl\n" if $VERBOSE > 1 ;
134 my $oDownloader = utils->new() ; 135 my $oDownloader = utils->new() ;
135 my ($fileZip) = $oDownloader->getHttpFile($bankUrl, $bankFilePath) ; 136 my ($httpStatus) = $oDownloader->getHttpFile($bankUrl, $bankFilePath) ;
137
138 if ($httpStatus ne '200 OK' ) {
139 unlink $bankFileDir ;
140 croak "\t/!\\ Download of $bankUrl failed with HTTP error: $httpStatus\n" ;
141 }
142 else {
143 print "\tDownloading process ended with HTTP: $httpStatus\n" ;
144 }
136 145
137 print "\tUnzip the download archive ($bankFilePath) and clean env ...\n" if $VERBOSE > 1 ; 146 print "\tUnzip the download archive ($bankFilePath) and clean env ...\n" if $VERBOSE > 1 ;
138 147
139 my $oUnzip = utils->new() ; 148 my $oUnzip = utils->new() ;
140 # if archive is a zip 149 # if archive is a zip