2 Comments
Guest *Cyrus M* @ 2016-08-11 19:18:27 originally posted:
Apparently publishing .rmd files to wordpress is not a concern of many stack overflow users bc most of the questions on there regarding this topic have gone unanswered. The knit2wp command no longer works. Produces the following error:
Error: faultCode: 401 faultString: Sorry, you are not allowed to publish posts on this site.
Same error regardless of wordpress account used or even what R environment and computer are used (i.e. its a problem reproducible on everyones account and everyones computer). Same error and issues with the commands from the RWordPress package as well (such as newPost command). It seems wordpress has updated their XML-RPC api, preventing remote access -at least for R users...Perhaps you can take a look at the issue since you're the package author of 1 of the 2 packages who has been dealt this blow. Thanks so much for developing the wonderful Knitr package and I look forward to hearing from you in regards to this ongoing problem.
Guest *Brandon Bertelsen* @ 2018-10-08 03:55:30 originally posted:
I'm using this in conjunction with cloudinary, which gives one access to a bunch of features that are extremely useful. Here is the function that I am using in place of imgur_upload()`
#' Upload images to cloudinary
#'
#' Create a cloud, get your api key, change to unsigned uploads.
#'
#' @param file The name of the file
#' @param api_key Your cloudinary api key
#' @param cloud The name of your cloudinary cloud
#' @param upload_preset The code corresponding to the upload preset
#' @importFrom httr POST content
#' @importFrom jsonlite fromJSON
#' @export
cloudinary_upload <- function (file, api_key = "API_KEY", cloud = "YOUR-CLOUD", upload_preset = "INSERT_PRESET") {
timestamp = as.character(round(as.numeric(Sys.time())))
resp = httr::POST(
paste0(
"<https://api.cloudinary.com/v1_1/>", cloud,
"/image/upload"
),
body = list(file = httr::upload_file(file),
api_key = api_key,
timestamp = timestamp,
upload_preset = upload_preset
)
)
structure(jsonlite::fromJSON(httr::content(resp, as="text"))$secure_url)
}
Sign in to join the discussion
Sign in with GitHub