ch_safe_GET: Executes GET function with error trapping

View source: R/utils.R

ch_safe_GETR Documentation

Executes GET function with error trapping

Description

Executes GET function with error trapping

Usage

ch_safe_GET(url = NULL, filename = NULL)

Arguments

url

Required. URL to be accessed.

filename

Required. File to be used to save data

Value

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

Author(s)

Kevin Shook

Examples


# 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)



CSHShydRology documentation built on Feb. 4, 2026, 5:06 p.m.