The rdocumentcloud package is an R wrapper for the DocumentCloud API.
Note: This package is currently a work in progress. Want to help? Check out our projects page.
Currently useful for authenticating and bulk uploading documents to an existing DocumentCloud project.
You can install the development version of rdocumentcloud from GitHub.
# install.packages("devtools")
devtools::install_github("MuckRock/rdocumentcloud")
#load the package into your environment after installing it
library(rdocumentcloud)
#create a list of document paths to upload
file_names <- c('./path/to/file/document2020_file.pdf', './path/to/file/test_file13.jpg', './path/to/file/public_record.pdf')
#specify a DocumentCloud project ID number where you want to upload documents
project_id <- 200555
#Authenticate with DocumentCloud API using username and password.
auth_response <- dc_auth('username@email.com', 'my_secret_password')
#> x AUTHENTICATION ERROR: 401
#Bulk upload of documents to DocumentCloud. Returns a dataframe
# of paths and destination urls. NOTE: must already be authenticated
dc_response <- upload_documents(file_names, project_id, unlist(auth_response$refresh))
#> ...BEGINNING UPLOAD AT SEPTEMBER 11, 2022 17:09:15 PM
#> x AUTHENTICATION ERROR: 400
#> x EXITING AFTER 0.035 SECONDS
documentcloud
Python wrapper- DocumentCloud API documentation
- Example package: Kyle Walker’s tidycensus
- R Packages: Organize, Test, Document and Share Your Code by Hadley Wickham