I?m dealing with an issue that is seemingly simple, and I?m sure there is an obvious solution. I?m writing a wrapper function that calls functions from another package (twitteR). However, the function I happen to be using in that package prompts the user the user to enter a ?1? or a ?2? in the workspace before the user can proceed. The actual process looks like this:> setup_twitter_oauth(APIkey,APIsecret, Accesstoken, Accesssecret)Use a local file to cache OAuth access credentials between R sessions? 1: Yes 2: No I know I want the value ?2? to be entered, but I cannot figure out how to automate it without a human actually entering ?2? and hitting enter when prompted. Is it possible to automate this so the user doesn?t have to manually hit enter? Harold [[alternative HTML version deleted]]
Poke around the help files (& perhaps source code) for package:httr to see
how to set
options("httr_oauth_cache"). E.g.,
help(package="httr", "Token-class")
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Thu, Mar 12, 2015 at 8:25 AM, Doran, Harold <HDoran at air.org> wrote:
> I?m dealing with an issue that is seemingly simple, and I?m sure there is
> an obvious solution. I?m writing a wrapper function that calls functions
> from another package (twitteR).
>
> However, the function I happen to be using in that package prompts the
> user the user to enter a ?1? or a ?2? in the workspace before the user can
> proceed. The actual process looks like this:
>
> > setup_twitter_oauth(APIkey,APIsecret, Accesstoken, Accesssecret)
>
> Use a local file to cache OAuth access credentials between R sessions?
> 1: Yes
> 2: No
>
> I know I want the value ?2? to be entered, but I cannot figure out how to
> automate it without a human actually entering ?2? and hitting enter when
> prompted.
>
> Is it possible to automate this so the user doesn?t have to manually hit
> enter?
>
> Harold
>
>
>
> [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
[[alternative HTML version deleted]]
Harold, This did the trick for my application, options(httr_oauth_cache=TRUE) See http://stackoverflow.com/questions/28221405/automated-httr-authentication-with-twitter-provide-response-to-interactive-pro for details. Jean On Thu, Mar 12, 2015 at 10:25 AM, Doran, Harold <HDoran at air.org> wrote:> I?m dealing with an issue that is seemingly simple, and I?m sure there is > an obvious solution. I?m writing a wrapper function that calls functions > from another package (twitteR). > > However, the function I happen to be using in that package prompts the > user the user to enter a ?1? or a ?2? in the workspace before the user can > proceed. The actual process looks like this: > > > setup_twitter_oauth(APIkey,APIsecret, Accesstoken, Accesssecret) > > Use a local file to cache OAuth access credentials between R sessions? > 1: Yes > 2: No > > I know I want the value ?2? to be entered, but I cannot figure out how to > automate it without a human actually entering ?2? and hitting enter when > prompted. > > Is it possible to automate this so the user doesn?t have to manually hit > enter? > > Harold > > > > [[alternative HTML version deleted]] > > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]