Skip to content

Commit

Permalink
update zenodo licenses for #91
Browse files Browse the repository at this point in the history
  • Loading branch information
mpadge committed Feb 19, 2024
1 parent f53465b commit 99e5613
Show file tree
Hide file tree
Showing 4 changed files with 457 additions and 513 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: deposits
Title: A universal client for depositing and accessing research data
anywhere
Version: 0.2.1.053
Version: 0.2.1.054
Authors@R:
person("Mark", "Padgham", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0003-2172-5265"))
Expand Down
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"codeRepository": "https://github.com/ropenscilabs/deposits",
"issueTracker": "https://github.com/ropenscilabs/deposits/issues",
"license": "https://spdx.org/licenses/MIT",
"version": "0.2.1.053",
"version": "0.2.1.054",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down
17 changes: 11 additions & 6 deletions data-raw/get-zenodo-licenses.R
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
token <- Sys.getenv ("ZENODO_TOKEN")
url <- "https://zenodo.org/api/licenses?size=1000"
url <- "https://zenodo.org/api/licenses"
headers <- list (Authorization = paste0 ("Bearer ", token))
con <- crul::HttpClient$new (url, headers = headers)
res <- con$get ()
lic <- jsonlite::fromJSON (res$parse (encoding = "UTF-8"))
lic <- lic$hits$hits$metadata
lic <- lic [, c ("id", "title", "url")]
req <- httr2::request (url)
req <- httr2::req_method (req, "GET")
req <- httr2::req_url_query (req, size = 1000)
resp <- httr2::req_perform (req)
resp_body <- httr2::resp_body_json (resp, simplify = TRUE)

lic <- resp_body$hits$hits [, c ("id", "title", "links")]
lic$title <- unlist (lic$title)
lic$links <- unlist (lic$links)
names (lic) [3] <- "url"

path <- fs::path (here::here (), "inst", "extdata", "zenodo", "zenodo_licenses.csv")
write.csv (lic, file = path, row.names = FALSE, fileEncoding = "UTF-8")
Loading

0 comments on commit 99e5613

Please sign in to comment.