Skip to content

Commit 35ae86b

Browse files
authored
Merge pull request #131 from dsweber2/apiKeys
removing the temporary API key fixes
2 parents f121d72 + 2e3e503 commit 35ae86b

File tree

3 files changed

+14
-31
lines changed

3 files changed

+14
-31
lines changed

R/epidatacall.R

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -184,22 +184,6 @@ fetch_classic <- function(epidata_call, fields = NULL, disable_data_frame_parsin
184184
response <- request_impl(epidata_call, "classic", fields)
185185
response_content <- httr::content(response, as = "text", encoding = "UTF-8")
186186

187-
# TODO Temporary workaround the first row of the response being a comment
188-
# Remove on 2023-06-21
189-
if (grepl("This request exceeded", response_content) && !epidata_call$only_supports_classic) {
190-
response_content <- jsonlite::fromJSON(response_content, simplifyDataFrame = FALSE)
191-
message <- response_content$epidata[[1L]]
192-
cli::cli_abort(c(
193-
"epidata warning, promoted to error: {message}",
194-
"i" = "Either:",
195-
"*" = "set the environment variable DELPHI_EPIDATA_KEY, or",
196-
"*" = 'set the option "delphi.epidata.key":',
197-
" " = '{.code options(delphi.epidata.key = "YOUR_KEY_OR_TEMP_KEY")}',
198-
"To save your key for later sessions (and hide it from your code), you can edit your .Renviron file with:",
199-
"*" = "usethis::edit_r_environ()"
200-
))
201-
}
202-
203187
response_content <- jsonlite::fromJSON(response_content, simplifyDataFrame = !disable_data_frame_parsing)
204188

205189
# success is 1, no results is -2, truncated is 2, -1 is generic error

tests/testthat/test-epidatacall.R

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -81,21 +81,20 @@ test_that("fetch_tbl warns on non-success", {
8181
.package = "httr"
8282
)
8383
# TODO: Turn these tests back on, when the API is fully online
84-
# Remove on 2023-06-21
85-
# artificial_warning <- "* This is a warning with a leading asterisk and {braces} to make sure we don't have bulleting/glue bugs."
86-
# debug_triplet <- readRDS(testthat::test_path("data/test-classic.rds")) %>%
87-
# jsonlite::fromJSON() %>%
88-
# `[[<-`("message", artificial_warning)
89-
# local_mocked_bindings(
90-
# # see generation code above
91-
# fromJSON = function(...) debug_triplet,
92-
# .package = "jsonlite"
93-
# )
84+
artificial_warning <- "* This is a warning with a leading asterisk and {braces} to make sure we don't have bulleting/glue bugs."
85+
debug_triplet <- readRDS(testthat::test_path("data/test-classic.rds")) %>%
86+
jsonlite::fromJSON() %>%
87+
`[[<-`("message", artificial_warning)
88+
local_mocked_bindings(
89+
# see generation code above
90+
fromJSON = function(...) debug_triplet,
91+
.package = "jsonlite"
92+
)
9493

95-
# expect_warning(epidata_call %>% fetch_tbl(),
96-
# regexp = paste0("epidata warning: ", artificial_warning),
97-
# fixed = TRUE
98-
# )
94+
expect_warning(epidata_call %>% fetch_tbl(),
95+
regexp = paste0("epidata warning: ", artificial_warning),
96+
fixed = TRUE
97+
)
9998
})
10099

101100
test_that("classic only fetch", {

vignettes/endpoints.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ Example call:
141141

142142
```{r}
143143
del <- delphi(system = "ec", epiweek = 201501) %>% fetch()
144-
names(del[[1L]]$forecast)
144+
names(del$forecast)
145145
```
146146

147147
### FluSurv hospitalization data

0 commit comments

Comments
 (0)