-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OAuth authorisation with rlist #81
Comments
Thanks, @pssguy! I think it is necessary for rlist to support OAuth to work with data APIs smoothly, but I don't have much experience on it. Would you please give some suggestions or send PR if you know how to do it. I also wonder if different data sources have different OAuth methods? |
Would strongly suggest just plugging into the OAuth from |
Thanks @timelyportfolio! |
Thanks tp. |
I forgot there is a |
Thanks, @timelyportfolio! I tried the demo and it works for me :) Let's see how we can make it easier in rlist. |
In this specific case, there is probably a way to combine usage of |
Thanks, @jennybc! It seems not straightforward to make it an one-click-and-go feature. |
@renkun-ken Do you mean it's hard to integrate Ouath into rlist or that you're skeptical about the suggestion to combine Here's a sketch where I am, shamefully, not using rlist, but I think you can see where rlist functions could be dropped in. Maybe you could add a suggestion to use library(plyr)
library(github)
# GITHUB_TOKEN envvar is defined in my ~/.Renviron
ctx <- create.github.context(access_token = Sys.getenv("GITHUB_TOKEN"))
# now do whatever I want w/ the API
# iss_dat <- …. a data.frame w/ one row per issue I need to open …..
foo <- alply(iss_dat, 1, function(x) {
# define line1, line2, etc.
list(title = sprintf("Peer review of %s's %s by %s",
x[["reviewee"]], this_hw, x[["reviewer"]]),
body = paste(line1, line2, line3, sep = "\n"),
assignee = x[["reviewer_gitName"]],
labels = c("peer-review", "hw02"),
repo = paste0("zz_", x[["reviewee"]], "_STAT540_2015"))
})
# here's where I could have used rlist::list.map()
ret_val <- llply(foo, function(x) {
repo <- x$repo
x$repo <- NULL
create.issue(owner = "STAT540-UBC", repo = repo, content = x)
})
# and here I could use list.mapv()?
ok <- laply(ret_val, function(x) x$ok)
table(ok) |
Thanks for your detailed and helpful information, @jennybc! It's great if rlist can make it easy to work with oauth, but shamefully I don't have much experience on it. I'll take a closer look at your examples and try to figure out a good way to do it. |
My advice is "don't get sucked into doing OAuth" within |
Agree. In your example, there may be no need to load json data to data.frame. foo <- list.select(iss_day,
title = sprintf("Peer review of %s's %s by %s", reviewee, this_hw, reviewer),
body = paste(line1, line2, line3, sep = "\n"),
assignee = reviewer_gitName,
labels = c("peer-review", "hw02"),
repo = paste0("zz_", reviewee, "_STAT540_2015")) ret_val <- list.map(foo,
create.issue(owner = "STAT540-UBC",
repo = repo,
content = list.remove(., "repo"))) ok <- list.mapv(ret_val, ok) |
I have been working through your github tutorial example http://renkun.me/rlist-tutorial/Examples/GitHub-API.html and reached the rate limit. Would it be possible to incorporate
the required codes as parameters in the list.load function or come up with some other solution. The same issue will apply to other APIs Tx
The text was updated successfully, but these errors were encountered: