Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 2c93cba
Author: lfagliano <[email protected]>
Date:   Wed Mar 13 17:52:13 2024 +0400

    Changes of Description and tests

commit d809aba
Merge: 4aa94ca e4aa98d
Author: lfagliano <[email protected]>
Date:   Wed Mar 13 17:27:26 2024 +0400

    Merge branch 'master' into Lucas-Branch

commit 4aa94ca
Author: lfagliano <[email protected]>
Date:   Wed Mar 13 15:32:21 2024 +0400

    to_rebase

    Initial commit pre moving, need to rebase
  • Loading branch information
lfagliano committed Mar 25, 2024
1 parent e4aa98d commit 15aea9f
Show file tree
Hide file tree
Showing 11 changed files with 450 additions and 391 deletions.
2 changes: 2 additions & 0 deletions .Renviorn
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
EMAIL_ADDRESS_EXAMPLES="[email protected]"
EXAMPLES_KEY="M3PWwg3DIdhHMuDiilp5"
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Authors@R: c(
person(given = "Rachel",
family = "Goodman",
role = "aut",
email = "r.goodman@acleddata.com"),
email = "goodman[email protected]"),
person(given = "Katayoun",
family = "Kishi",
role = "aut",
Expand Down
33 changes: 17 additions & 16 deletions R/acled_access.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,31 @@
#' @md


acled_access <- function(email,key) {

url <- paste0("https://api.acleddata.com/check/read/?email=",email,"&","key=",key)
acled_access <- function(email, key) {
url <- paste0("https://api.acleddata.com/check/read/?email=", email, "&", "key=", key)


response <- httr::GET(url)
out <- httr::content(response)

if (out$status != 200) {
if ((out$error$message) == "Incorrect email or access key entered. Please try again.") {
stop(paste0("Error: ",out$error$message, ". Error code: ", out$status,". \n"
,rlang::format_error_bullets(c("Key and email not authorized. Please verify your API credentials (key and email) and try again",
"If the error persists please contact [email protected]."))))
stop(paste0(
"Error: ", out$error$message, ". Error code: ", out$status, ". \n",
rlang::format_error_bullets(c(
"Key and email not authorized. Please verify your API credentials (key and email) and try again",
"If the error persists please contact [email protected]."
))
))
} else {
stop(paste0("Error: ",out$error$message, ". Error code: ", out$status))
}} else {

if(out$status == 200) {
message("Success! Credentials authorized")
}

Sys.setenv(acled_email = email)
Sys.setenv(acled_key = key)

stop(paste0("Error: ", out$error$message, ". Error code: ", out$status))
}
} else {
if (out$status == 200) {
message("Success! Credentials authorized")
}

Sys.setenv(acled_email = email)
Sys.setenv(acled_key = key)
}
}
Loading

0 comments on commit 15aea9f

Please sign in to comment.