R - Download data from the Hidroweb portal

1

The National Water Agency makes available on the Hidroweb portal for downloading historical series referring to data obtained by various stations monitoring.

I would like to automate the download of these historical series, however ANA has altered your site and I am having difficulty performing the task. In this question is the code in R that I relied on to download the files.

At first I replaced the links from http://hidroweb.ana.gov.br/ to http://www.snirh.gov.br/hidroweb/ , however, the download could not be performed correctly.

I imagine the problem is in the r <- POST(url = paste0(baseurl[1], est, baseurl[2]), body = list(cboTipoReg = "10"), encode = "form") line, since the POST command does not seem to be able to properly access the http://www.snirh.gov.br/hidroweb/Estacao.asp?Codigo=2851050&CriaArq=true&TipoArq=1 link.

When accessed with query &CriarArq=true&TipoArq=1 , the site only displays the message "Request not allowed", and it is not possible to perform page scraping to find the .zip file.

I had imagined that only the POST command with the previous URL and the form cboTipoReg = '10' would suffice, but it seems to be not accessing the page as expected. Would anyone know to explain to me what's wrong?

    
asked by anonymous 11.03.2018 / 02:41

0 answers