Created
May 9, 2022 15:28
-
-
Save jrosell/9ca888e13f55d1101101adb7fbe8dd3a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kgl_competitions_data_download <- function(competition_id, file_name, path = ".") { | |
.kaggle_base_url <- "https://www.kaggle.com/api/v1" | |
url <- paste0(.kaggle_base_url, "/competitions/data/download/", competition_id, "/", file_name) | |
rcall <- httr::GET(url, httr::authenticate(Sys.getenv("KAGGLE_USER"), Sys.getenv("KAGGLE_KEY"), type = "basic")) | |
tmp <- tempfile() | |
download.file(rcall$url, tmp) | |
invisible(file.copy(tmp, paste0(path, "/", file_name))) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment