-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
Showing
11 changed files
with
450 additions
and
391 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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
EMAIL_ADDRESS_EXAMPLES="[email protected]" | ||
EXAMPLES_KEY="M3PWwg3DIdhHMuDiilp5" |
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 |
---|---|---|
|
@@ -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", | ||
|
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 |
---|---|---|
|
@@ -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) | ||
} | ||
} |
Oops, something went wrong.