You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! At my institution we are using Zenodo more and more to archive data. We are looking for ways to interact with Zenodo from R and this package looks very promising.
One thing I noticed when trying the functions was that a safe way to supply and access a token is missing. I wrote a small function taken from remotes::github_pat(). The idea is to add the token to ZENODO_PAT variable in the .Renviron file. The following function zenodo_pat() can then be used to get the personal access token:
#' Retrieve Zenodo personal access token.
#'
#' A zenodo personal access token
#' Looks in env var `ZENODO_PAT`
#'
#' @keywords internal
#' @noRd
zenodo_pat <- function(quiet = TRUE) {
pat <- Sys.getenv("ZENODO_PAT")
if (nzchar(pat)) {
if (!quiet) {
message("Using zenodo PAT from envvar ZENODO_PAT")
}
return(pat)
}
NULL
}
Thanks @hansvancalster, i'm aware of the printing issue when putting zenodo. At that time, no specific printing has been set, and the default R6 printing displays private fields (including the token). I will see if I can add a default printer that hides it, and let you know.
As for the function you suggest, i don't see direct added value to have it. As it is, user is free to call directly Sys.getenv with the variable name he choses for setting the Zenodo token.
Thanks for looking into this! Regarding the zenodo_pat() function, I had a similar default behaviour for token = zenodo_pat() as in install_github(...., auth_token = github_pat(), ...) in mind, which I think is very user-friendly.
Hi! At my institution we are using Zenodo more and more to archive data. We are looking for ways to interact with Zenodo from R and this package looks very promising.
One thing I noticed when trying the functions was that a safe way to supply and access a token is missing. I wrote a small function taken from
remotes::github_pat()
. The idea is to add the token to ZENODO_PAT variable in the.Renviron
file. The following functionzenodo_pat()
can then be used to get the personal access token:Usage:
However, when printing
zenodo
the secret token will be printed as well, which I think should best be avoided.I will also file another issue with an idea for a function to download a zenodo archive.
The text was updated successfully, but these errors were encountered: