-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove pingr dependency. All servers of Hydroscope are currently not …
…working
- Loading branch information
Showing
31 changed files
with
349 additions
and
443 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
Package: hydroscoper | ||
Type: Package | ||
Title: Interface to the Greek National Data Bank for Hydrometeorological Information | ||
Version: 1.6.0 | ||
Version: 1.7.0 | ||
Authors@R: c(person("Konstantinos", "Vantas", | ||
role = c("aut", "cre"), | ||
email = "[email protected]", | ||
|
@@ -24,15 +24,14 @@ Depends: R (>= 3.4) | |
License: MIT + file LICENSE | ||
Encoding: UTF-8 | ||
LazyData: true | ||
RoxygenNote: 7.3.0 | ||
RoxygenNote: 7.3.2 | ||
Imports: stringi (>= 1.8), | ||
stringr (>= 1.5), | ||
tibble(>= 3.2), | ||
pingr (>= 2.0), | ||
readr (>= 2.1), | ||
jsonlite (>= 1.8) | ||
Suggests: | ||
ggplot2 (>= 3.4), | ||
ggplot2 (>= 3.5), | ||
knitr (>= 1.45), | ||
rmarkdown (>= 2.25), | ||
testthat (>= 3.2) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,30 +4,29 @@ server_address <- function(subdomain) { | |
paste0(subdomain, ".hydroscope.gr") | ||
} | ||
|
||
#' Ping a remote server to see if its alive | ||
#' Check if a remote server is alive | ||
#' @noRd | ||
server_alive <- function(subdomain) { | ||
|
||
err_msg <- paste( | ||
"The server for that data source is probably down,", | ||
"get more info at [email protected] or try", | ||
"again later." | ||
) | ||
tryCatch({ | ||
pingr::ping_port(server_address(subdomain), | ||
port = 80L, | ||
count = 1 | ||
) | ||
if (all(is.na(pingr::ping_port(server_address(subdomain), | ||
port = 80L, | ||
count = 3 | ||
)))) { | ||
stop() | ||
} | ||
}, | ||
error = function(e) { | ||
stop(err_msg, call. = FALSE) | ||
|
||
# test the http capabilities of the current R build | ||
if (!capabilities(what = "http/ftp")) { | ||
stop("The current R build has no http capabilities") | ||
} | ||
) | ||
|
||
# test connection by trying to read first line of url | ||
test <- try(suppressWarnings(readLines(url, n = 1)), silent = TRUE) | ||
|
||
# return FALSE if test inherits 'try-error' class | ||
if (inherits(test, "try-error")) { | ||
stop(err_msg) | ||
} | ||
|
||
} | ||
|
||
#' create coords from points | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.