flickrSession: Constructor for convenience object for Flickr calls

Description Usage Arguments Value Author(s) References See Also Examples

Description

This function and the associated class and methods provide a mechanism for invoking Flickr API operations more conveniently from R than the regular flickr.* functions in this package. Using this function flickrSession, we create a FlickrSession object having received an auth_token via authenticate (and previously having registered an application with Flickr and obtaining an api_key and secret). The \$ method for this object uses matching to allow users refer to Flickr API functions using shorter names, e.g. getHotList rather than flickr.tags.getHotList. Also, it inserts the api_key, auth_token and secret into each call, removing the need to explicitly specify them in calls to the top-level flickr.* functions in this package. This is both more convenient and also makes the R commands/scripts more secure by not having private information visible in the calls. The FlickrSession object can be created once outside of the script.

Usage

1
flickrSession(secret, auth_token, api_key)

Arguments

api_key

a string. See the documentation in Rflickr.xml in the doc/ directory for how to register an application and create an api_key and secret.

auth_token

the string returned from a call to authenticate (or directly from flickr.auth.getToken.

secret

a string that comes with the creation of an application.

Value

An object of class FlickrSession. This has a $ method for easy invocation of Flickr operations.

Author(s)

Duncan Temple Lang

References

http://www.flickr.com/services/api

See Also

flickrSession All of the flickr.* functions.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
  hot = flickr.tags.getHotList(secret, token, api_key)

  s = flickrSession(secret, authenticate(api_key, secret), api_key)
  s$getHotList()

  now = Sys.time()
  dates = paste(as.integer(c(now  - 21*60*60*24, now)), collapse = ",")
  s$getCounts(dates)

## End(Not run)

duncantl/Rflickr documentation built on May 15, 2019, 5:54 p.m.