set_token: Set token

Description Usage Arguments Value Examples

View source: R/set-token.R

Description

Stores Twitter API token information for the duration of the session

Usage

1

Arguments

x

Either a token or path to a token. If path, the token is read using readRDS (this is default rtweet behavior). If token, it is saved in the current working directory as ".rtweet_token"

Value

The token is invisibly returned but more importantly the environment variable "TWITTER_PAT" is set to point toward the saved token file. This will be reset at the end of the session.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## if your system already has an environment variable for an rtweet token,
## this will return the path
(pat <- Sys.getenv("TWITTER_PAT"))

## if your system doesn't have this environment variable OR if you wish to
## override this value, then enter the desired path or token object
#pat <- "/path/to/rtweet-token.rds"

## and then set the token for use for the remainder of the session
#set_token(pat)

mkearney/rtweet.download documentation built on Dec. 14, 2019, 7:27 p.m.