Thanks for the information. How do I generate a new cookie for each session in R? The R code for the function getSymbols that gets the data is at
https://github.com/joshuaulrich/quantmod/blob/master/R/getSymbols.R
Here is the block of code that has "cookie" in it:
new.session <- function() {
tmp <- tempfile()
on.exit(unlink(tmp))
for (i in 1:5) {
h <- curl::new_handle()
curl::handle_setopt(h, .list = curl.options)
# random query to avoid cache
ru <- paste(sample(c(letters, 0:9), 4), collapse = "")
cu <- paste0("
https://finance.yahoo.com?", ru)
curl::curl_download(cu, tmp, handle = h)
if (NROW(curl::handle_cookies(h)) > 0)
break;
Sys.sleep(0.1)
}
if (NROW(curl::handle_cookies(h)) == 0)
stop("Could not establish session after 5 attempts.")
return(h)
}