getConnection: Connect to Google Documents server

getGoogleDocsConnectionR Documentation

Connect to Google Documents server

Description

These functions provide the mechanism with which to login to Google Docs and create a connection which caches the authentication so that it can be used in subsequent interactions with the Google Docs API within this R session.

If the login and password are not specified in a call to either function, we look for it in the option named GoogleDocsPassword. This should be a vector of length 2 giving the login and password, or alternatively a named character vector of length 1 where the value is the password and the name is the login. If the option is not set, we look in the environment variable GOOGLE_DOCS_PASSWORD. If this is set, its value is used and should be in the form login=value.

Usage

getGoogleDocsConnection(..., auth, error = TRUE)
getGoogleAuth(login = getOption("GoogleDocsPassword"), password,
                 service = "writely", appID = "R-GoogleDocs-0.1", error = TRUE)

Arguments

...

arguments that are passed on to getGoogleAuth For "convenience", one can also pass the authentication token returned from explicitly calling getGoogleAuth .

auth

the value returned from a call to getGoogleAuth.

login

the user name/login for the Google account

password

the password for the account corresponding to login

service

the name of the Google service, i.e. writely, wise

appID

unused

error

a logical value indicating whether, if TRUE, to raise an error (i.e. call to stop or just return NULL if error is FALSE.)

Value

An object of class either "GoogleSpreadsheetsConnection" or "GoogleDocsConnection" depending on which service was requested - wise or writely, respectively. This object is actually a Curl handle and can be used in subsequent HTTP requests.

Author(s)

Duncan Temple Lang

References

http://code.google.com/apis/accounts/docs/AuthForInstalledApps.html

See Also

getGoogleAuth

Examples

if(exists("GoogleDocsPassword")) {
   con = getGoogleDocsConnection(names(GoogleDocsPassword), GoogleDocsPassword)
   # for all documents
  con = getGoogleDocsConnection("dtemplelang@gmail.com", "my password")
   # for spreadsheets
  con = getGoogleDocsConnection("dtemplelang@gmail.com", "my password", "wise")

   # Getting auth separately.
  auth = getGoogleAuth("dtemplelang@gmail.com", "my password", "wise")
  con = getGoogleDocsConnection(auth)
  con = getGoogleDocsConnection(auth = auth)
}

duncantl/RGoogleDocs documentation built on Nov. 23, 2023, 4:22 p.m.