karthik / karthik/rDrop

saving dropbox_credentials in .Rprofile

Open
#3 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
R
Stars
65
Forks
15
PR merge metrics
No merged PRs in 30d

Description

Hi thanks for your answer on stackoverflow...but am not amazingly keen on having to load an `*.RData` file to collect the token info, is there a way that all the data can be held in .Rprofile as I think this would produce a much cleaner solution...I tried replicating the output of `dropbox_auth()` and saving that in .Rprofile but have come across errors. I.e. i included new options for `OAuthKey` and `OAuthSecret` which would be called when creating an DropboxCredentials object within a function, but it doesn't seem to work for some reason... here is the function I am using...

```
db.csv.download <- function(dropbox.path, ...){

suppressPackageStartupMessages(require(rDrop))

dc <- new("DropboxCredentials",
consumerKey= getOption('DropboxKey'),
consumerSecret= getOption('DropboxSecret'),
oauthKey= getOption('DropboxOAuthKey'),
oauthSecret= getOption('DropboxOAuthSecret'),
requestURL="https://api.dropbox.com/1/oauth/request_token",
authURL="https://www.dropbox.com/1/oauth/authorize",
accessURL="https://api.dropbox.com/1/oauth/access_token/",
signMethod="HMAC")
attr(slot(dc,"oauthKey"),'names') <- "oauth_token"
attr(slot(dc,"oauthSecret"),'names') <- "oauth_token_secret"

raw.data <- dropbox_get(dc,dropbox.path)
data <- read.csv(textConnection(raw.data), ...)
data
}
```

the `dc` object should be replicating the output of `dropbox_auth()` but using static data generated from previously running the function.

Also I saw your commits for the `db.read.csv` function...for some reason the `unserialize` part doesnt work for me so I prefer using `read.csv(textConnection(file))` as shown in my function...

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the shown db.csv.download function and its DropboxCredentials construction, then compare it with dropbox_auth() and the .Rprofile options described. Reproduce the reported credential-loading errors and inspect the dropbox_get call; done should establish whether static credentials work without an .RData file while retaining the read.csv(textConnection(file)) approach.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
api, cloud
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.