Automated Httr Authentication with Twitter , Provide Response to Interactive Prompt in "Batch" Mode

Automated httr authentication with twitteR , provide response to interactive prompt in batch mode

You can try setting the httr_oauth_cache option to TRUE:

options(httr_oauth_cache=T)

The twitteR package uses the httr package, on the Token manual page for that package they give tips about caching:

OAuth tokens are cached on disk in a file called .httr-oauth 
saved in the current working directory. Caching is enabled if:

The session is interactive, and the user agrees to it, OR

The .httr-oauth file is already present, OR

getOption("httr_oauth_cache") is TRUE

You can suppress caching by setting the httr_oauth_cache option to FALSE.

Passing arguments to an interactive program non-interactively

For more complex tasks there is expect ( http://en.wikipedia.org/wiki/Expect ).
It basically simulates a user, you can code a script how to react to specific program outputs and related stuff.

This also works in cases like ssh that prohibits piping passwords to it.

Automatically answer to input prompt in windows batch

You want this:

echo y | [Command]

Eg: echo y | program.exe

"echo <answer> | <batch command>"

Ex: The del /P command option will prompt for user's confirmation before deleting the file.
So if you are using this option in your batch script, it requires manual input to proceed further.
To avoid this manual input, use the command "echo Y | del /P " in your batch script to answer the prompt.

You can try this echo command to pass input (ex: answer for username and password prompts) to your console application, when it is invoked through batch script.

Refer: http://thirutechie.blogspot.com/2009/10/how-to-auto-answer-prompts-in-windows.html



Related Topics



Leave a reply



Submit