dfe-analytical-services / dfeR

Common R tasks in the Department for Education (DfE)
https://dfe-analytical-services.github.io/dfeR/
GNU General Public License v3.0
9 stars 2 forks source link

Add dfe proxy function #3

Closed adamrobinson361 closed 5 years ago

adamrobinson361 commented 6 years ago

Background

Add a function that can be used to generate the proxy credentials for R

matt-dray commented 6 years ago

I assume we want this to be dependency-free, but we could use the rstudioapi::showPrompt() and rstudioapi::askForPassword() approach -- these functions provide a GUI for inputting username and password without having to create and store text files with these details.

peterrobertcurtis commented 6 years ago

Adam suggested looking into using windows authentication. It's a little beyond my knowledge, but I'm going to see what I can get working.

Regarding dependency-free inputs, a simple readlines() can get inputs from the console, or utils::winDialogString can do the same from a dialog box. I'll add it as an option.

peterrobertcurtis commented 6 years ago

From what I can see, I still need to pass a username and password, at least using httr, so it needs to be either input or stored in a file somewhere. If someone knows better, please let me know.

A global approach, such as setting the proxy settings in .Renviron might be viable, but I've never managed to get it to work, so someone else may want to take up that baton.

Also, is my method httr specific? Does anyone use other packages for scraping, and will setting the proxy with httr travel over to other packages?

peterrobertcurtis commented 6 years ago

The package https://github.com/r-lib/keyring looks like it can access windows credentials. I'm not volunteering to implement it (I have no time right now), but this may be a viable way forward