R/utils.R

Defines functions perform_riem_request

#' @importFrom utils read.table
#' @importFrom magrittr %>%
#' @importFrom rlang !!!
#' @importFrom rlang %||%
#' @importFrom jsonlite read_json

perform_riem_request <- function(path, query = NULL) {
  "https://mesonet.agron.iastate.edu/" %>%
    httr2::request() %>%
    httr2::req_url_path_append(path) %>%
    httr2::req_url_query(!!!query) %>%
    httr2::req_user_agent("riem (https://docs.ropensci.org/riem)") %>%
    httr2::req_retry(max_tries = 3, max_seconds = 120) %>%
    httr2::req_perform()
}

Try the riem package in your browser

Any scripts or data that you put into this service are public.

riem documentation built on Feb. 8, 2022, 5:13 p.m.