Skip to content

Commit

Permalink
Move curl to strong dependence; gracefully fail when there is no inte…
Browse files Browse the repository at this point in the history
…rnet
  • Loading branch information
irudnyts committed Nov 14, 2021
1 parent 504ebe0 commit 24f5fec
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ Imports:
quantmod (>= 0.4.18),
zoo (>= 1.8.9),
matrixStats (>= 0.60.0),
Rcpp (>= 1.0.7)
Rcpp (>= 1.0.7),
curl (>= 4.3.2)
LinkingTo: Rcpp
RoxygenNote: 7.1.1
Suggests:
knitr (>= 1.33),
rmarkdown (>= 2.10),
purrr (>= 0.3.4),
curl (>= 4.3.2),
shiny (>= 1.6.0),
shinyFeedback (>= 0.4.0),
shinyWidgets (>= 0.6.0),
Expand Down
4 changes: 4 additions & 0 deletions R/get_prices_from_tickers.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ get_prices_from_tickers <- function(..., start, end,
quote <- match.arg(quote)
retclass <- match.arg(retclass)
tickers <- c(...)
if (!curl::has_internet()) {
message("Please make sure you have an internet connection.")
return(invisible(NULL))
}
# for avoiding check inside the loop, the if/else is done outside the loop,
# that is why so many repetition of the code. Done for optimality and speed.
if(retclass == "list") {
Expand Down
4 changes: 2 additions & 2 deletions R/run_app.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ run_app <- function() {
check_installation("purrr")

packages <- c(
"curl", "shiny", "shinyFeedback", "shinyWidgets", "DT", "bslib",
"stringr", "magrittr", "formattable", "dplyr"
"shiny", "shinyFeedback", "shinyWidgets", "DT", "bslib", "stringr",
"magrittr", "formattable", "dplyr"
)

purrr::walk(packages, check_installation)
Expand Down

0 comments on commit 24f5fec

Please sign in to comment.