In 2024 CQC required registration for API key.#3
Open
simondashnash wants to merge 10 commits into
Open
Conversation
This commit adds a file subscription_key.R which replaces partner_code.R and amends multiple other files to use a new base URL and pass the API key in the header.
evanodell
reviewed
Aug 22, 2024
Owner
There was a problem hiding this comment.
Instead of commenting out old functions you can remove them entirely.
Otherwise it looks good to me. I've not been actively maintaining any of my R packages so I'm rusty on the code but it seems to work.
Also please add yourself as a contributor in the DESCRIPTION file and bump the version up.
Comment on lines
+32
to
+58
| # cqc_query_construction <- function(query) { | ||
| # partner_code <- getOption("cqc.partner.code") | ||
|
|
||
| # if (is.null(partner_code)) { | ||
| # message("CQC Partner Code not set.") | ||
| # } else if (!grepl("&", query)) { | ||
| # query <- paste0(query, "?") | ||
| # } | ||
|
|
||
| # query2 <- paste0( | ||
| # baseurl, query, partner_code | ||
| # ) | ||
|
|
||
| # query2 <- gsub("?&partnerCode=", "?partnerCode=", query2, fixed = TRUE) | ||
|
|
||
| # x <- httr::GET(query2) | ||
|
|
||
| # if (httr::status_code(x) != "200") { | ||
| # stop(paste( | ||
| # "Request returned error code:", | ||
| # httr::status_code(x) | ||
| # ), call. = FALSE) | ||
| # } | ||
|
|
||
| # suppressMessages(cont <- jsonlite::fromJSON(httr::content(x, "text"))) | ||
|
|
||
| # cont |
Owner
There was a problem hiding this comment.
Instead of commenting out old formulas can you remove them entirely?
Author
|
Hi. Simon |
Author
|
I amended the tests to prompt user for API key, did some other tidying as you advised, added myself as a contributor and incremented the version number. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi Evan
I had a go at updating your library to work with CQC's API key. Please could you review and merge if its OK?
This commit adds a file subscription_key.R which replaces partner_code.R and amends some other files to use a new base URL and pass the API key in the header. I also amended the introduction.Rmd file to reflect CQC's change.
Yours
Simon