Skip to content

saving dropbox_credentials in .Rprofile #3

@hmaeda

Description

@hmaeda

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...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions