@@ -23,6 +23,9 @@ telechargerFichier <- function(donnees, date=NULL, telDir=getOption("doremifasol
2323
2424 # # vérifie donnees et date. si ok les infos nécessaires sont extraites dans caract
2525 caract <- infosDonnees(donnees , date )
26+
27+ # # test de la connexion
28+ if (! curl :: has_internet()) stop(" aucune connexion Internet" )
2629
2730 # dossier de téléchargement # si NULL aller dans le cache
2831 cache <- FALSE
@@ -40,7 +43,6 @@ telechargerFichier <- function(donnees, date=NULL, telDir=getOption("doremifasol
4043 dl <- NULL
4144
4245 if (! file.exists(nomFichier ) || force ) {
43- if (! curl :: has_internet()) stop(" aucune connexion Internet" )
4446 res <- try(httr :: GET(caract $ lien , httr :: write_disk(nomFichier , overwrite = TRUE ), httr :: progress()))
4547 if (res $ status_code == 200 ) dl <- 0
4648 if (tools :: md5sum(nomFichier ) != caract $ md5 ) {
@@ -104,8 +106,6 @@ telechargerFichier <- function(donnees, date=NULL, telDir=getOption("doremifasol
104106 stop(" d\u 00e9finir les variables d'environnement INSEE_APP_KEY et INSEE_APP_SECRET" )
105107 }
106108
107- if (! curl :: has_internet()) stop(" aucune connexion Internet" )
108-
109109 timestamp <- gsub(" [^0-9]" , " " , as.character(Sys.time()))
110110 dossier_json <- paste0(telDir , " /json_API_" , caract $ nom , " _" , timestamp , " _" , genererSuffixe(4 ))
111111 dir.create(dossier_json )
0 commit comments