R/check_internet.R

Defines functions check_internet

Documented in check_internet

#' Check whether the internet is on
#'
#' Check for internet
#' @return TRUE if internet connection is detected, FALSE otherwise.
#' @importFrom httr GET
#' @keywords internal
check_internet <- function() {
  tryCatch(class(httr::GET("http://www.google.com/")) == "response",
    error = function(e) {
      return(FALSE)
    }
  )
}
EnquistLab/RTNRS documentation built on Oct. 14, 2024, 2:11 p.m.