Information download (Fault - Network error)

Asked

Viewed 63 times

1

Hello,

I’m having difficulty downloading data from Anatel’s website through R

Goal: Download data from Anatel’s website

url = 'https://www.anatel.gov.br/dadosabertos/paineis_de_dados/acessos/'
for (filename in c('acessos_telefonia_fixa',
                    'acessos_banda_larga_fixa',
                    'acessos_tv_por_assinatura',
                    'acessos_telefonia_movel'
                    )){
 
   download.file(
     paste(url, filename, '.zip', sep=''),
     paste(folder, filename, '.zip', sep=''),
     method = 'libcurl',
     quiet = FALSE, mode = "wb", cacheOK = TRUE, timeout = 600000)
   gc()
 
   tmp <- tempfile()
   curl_download(paste(url, filename, '.zip', sep=''), tmp)
 
   print(file.info(paste(folder, filename, '.zip', sep='')))
   Sys.sleep(1)
   unzip(paste(folder, filename, '.zip', sep=''), list = TRUE, overwrite = TRUE, exdir = folder)
   gc(0)
   
 }

Return message Error in download.file(Paste(url, filename, ". zip", Sep = ""), Paste(Folder, : download from 'https://www.anatel.gov.br/dadosabertos/paineis_de_dados/acessos_banda_larga_fixa.zip' failed

Situation I use this same code to download several other files, but I believe that this does not work due until the manual download shows error (at first).

When accessing Anatel’s website, manually download the files returns me the message "Fault - Network error" and I have to click to resume the download, only so the file is fully downloaded.

Could someone help me?

I’m available in case my explanation wasn’t clear. Thank you in advance!!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.