-
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.
* fail gracefully if not conecting to server * strip xml2 * dont use ping, use dontrun * update check action * add cran comments2 * bump version * update news * fix readme urls * examples on interactive * reduce example * use httr2, fail gracefully * dont error on httr fail,
- Loading branch information
1 parent
9ace064
commit 9c7d3da
Showing
24 changed files
with
210 additions
and
126 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 |
---|---|---|
|
@@ -5,3 +5,4 @@ | |
^\.github$ | ||
^cran-comments\.md$ | ||
^CRAN-RELEASE$ | ||
^CRAN-SUBMISSION$ |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Version: 0.1.4 | ||
Date: 2023-09-07 19:55:56 UTC | ||
SHA: | ||
d0cf9e1372771e89b74a37c0ea69e75934b91d26 |
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 |
---|---|---|
@@ -1,3 +1,7 @@ | ||
|
||
# colorhex 0.1.4 | ||
- fixes failure of build if server is unresponsive | ||
|
||
# colorhex 0.1.1 | ||
- cran submission | ||
|
||
|
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
query_colorhex <- function(){ | ||
if(!curl::has_internet()){ | ||
cli::cli_alert_warning("Not connected to internet.") | ||
return(invisible(NULL)) | ||
} | ||
req <- httr2::request(colour_url()) | ||
req <- httr2::req_retry(req, | ||
backoff = ~ 10, | ||
is_transient = ~ httr2::resp_status(.x) > 400) | ||
req <- httr2::req_error(req, | ||
is_error = function(resp) FALSE, | ||
body = error_body) | ||
req | ||
} | ||
|
||
colour_url <- function(full = TRUE){ | ||
url <- "www.color-hex.com" | ||
if(!full) | ||
return(url) | ||
paste0("https://", url, "/") | ||
} | ||
|
||
error_body <- function(resp) { | ||
httr2::resp_body_json(resp)$error | ||
} | ||
|
||
status_ok <- function(req){ | ||
test <- httr2::req_perform(req) | ||
if(httr2::resp_status(test) > 400 ){ | ||
cli::cli_alert_warning("Cannot connect to service.") | ||
cli::cli_inform(httr2::resp_status_desc(test)) | ||
return(FALSE) | ||
} | ||
TRUE | ||
} |
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
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
Oops, something went wrong.