Skip to content

Commit

Permalink
Fail more graciously
Browse files Browse the repository at this point in the history
  • Loading branch information
llrs committed Sep 15, 2024
1 parent ad5a5f8 commit 135f96c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion R/call.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# <https://api.esios.ree.es/doc/index.html>
prep_esios <- function(path, ..., token = NULL) {
token <- get_token(token)
if (!there_is_token(token)) {
return(FALSE)
warning("No token available")
}
accept <- c("application/json",
"application/vnd.esios-api-v2+json",
"application/vnd.esios-api-v1+json")
Expand All @@ -12,7 +16,9 @@ prep_esios <- function(path, ..., token = NULL) {
req_error(body = esios_error) |>
req_headers(
Accept = paste0(accept, collapse = "; "),
`x-api-key` = token
`Content-Type` = "application/json",
`x-api-key` = token,
.redact = "x-api-key"
) |>
req_throttle(10 / 60)
}
Expand Down

0 comments on commit 135f96c

Please sign in to comment.