Learn R Programming

CSHShydRology (version 1.4.6)

ch_safe_GET: Executes GET function with error trapping

Description

Executes GET function with error trapping

Usage

ch_safe_GET(url = NULL, filename = NULL)

Value

Returns a character string: "OK" if all went well, the error message if it did not.

Arguments

url

Required. URL to be accessed.

filename

Required. File to be used to save data

Author

Kevin Shook

Examples

Run this code
# \donttest{
# Not tested automatically as can be very slow
test_url <- "https://zenodo.org/record/4781469/files/sm_data.csv"
dir_name <- tempdir(check = FALSE)
if (!dir.exists(dir_name)) {
  dir.create(dir_name, recursive = TRUE)
}
test_file <- file.path(dir_name, "gs_dem25.tif")
result <- ch_safe_GET(test_url, test_file)
# }

Run the code above in your browser using DataLab