From c6381e65641f15a4e826e3759a34495191b20955 Mon Sep 17 00:00:00 2001 From: mkearney Date: Wed, 1 May 2019 12:17:16 -0500 Subject: [PATCH] update docs --- docs/articles/auth.html | 233 ++++++++++++++++++++++++++++++ docs/index.html | 2 +- docs/reference/get_followers.html | 4 + docs/reference/get_friends.html | 4 + docs/reference/round_time.html | 2 +- man/post_tweet.Rd | 31 ++-- 6 files changed, 258 insertions(+), 18 deletions(-) create mode 100644 docs/articles/auth.html diff --git a/docs/articles/auth.html b/docs/articles/auth.html new file mode 100644 index 00000000..77ab5345 --- /dev/null +++ b/docs/articles/auth.html @@ -0,0 +1,233 @@ + + + + + + + +Obtaining and using access tokens • rtweet + + + + + + + + + + + +
+
+ + + +
+
+ + + + +
+

+rtweet

+

This vignette covers how to obtain and use Twitter API access tokens for use in the rtweet package.

+
+
+

+Creating a Twitter App

+
    +
  • To create a Twitter app, navigate to apps.twitter.com and create a new app by providing a Name, Description, and Website of your choosing (example screenshot provided below).

  • +
  • Important In the Callback URL field, make sure to enter the following: http://127.0.0.1:1410

  • +
  • Check yes if you agree and then click “Create your Twitter application”.

  • +
+

+creating

+
+
+

+Authorization methods

+

Users can create their personal access token in two different ways. Each method is outlined below.

+
+

+1. Browser-based authentication

+
    +
  • Authentication via web browser requires the httpuv package to be installed.
  • +
+ +
    +
  • Click the tab labeled Keys and Access Tokens to retrieve your keys.
  • +
+

+created

+
    +
  • In the Keys and Access Tokens tab, locate the values Consumer Key (aka “API Key”) and Consumer Secret (aka “API Secret”).
  • +
+

+keys

+
    +
  • Copy and paste the two keys (along with the name of your app) into an R script file and pass them along to create_token().
  • +
+ +
    +
  • A browser window should pop up. Click to approve (must be signed into twitter.com) and return to R.

  • +
  • The create_token() function should automatically save your token as an environment variable for you. To make sure it worked, compare the created token object to the object returned by get_token()

  • +
+ +
+
+

+2. Access token/secret method

+
    +
  • Click the tab labeled Keys and Access Tokens to retrieve your keys.
  • +
+

+created

+
    +
  • In the Keys and Access Tokens tab, locate and copy/paste values Consumer Key (aka “API Key”) and Consumer Secret (aka “API Secret”) into an R script.
  • +
+

+keys

+
    +
  • In the Keys and Access Tokens tab, scroll down to Token Actions and click Create my access token.
  • +
+

+gen_token

+
    +
  • That should generate two access keys Access Token and Access Token Secret +
  • +
+

+accesskeys

+
    +
  • Locate and copy/paste the Consumer Key (aka “API Key”), Consumer Secret (aka “API Secret”), Access Token, and Access Token Secret values and pass them along to create_token(), storing the output as a token object.
  • +
+ +
    +
  • The create_token() function should automatically save your token as an environment variable for you. To make sure it worked, compare the created token object to the object returned by get_token() +
  • +
+ +

That’s it!

+
+
+
+ + + +
+ + + +
+ + + + + diff --git a/docs/index.html b/docs/index.html index 6575604f..eb9323f9 100644 --- a/docs/index.html +++ b/docs/index.html @@ -143,7 +143,7 @@

All users must be authorized to interact with Twitter’s APIs. To become authorized, simply use a function like search_tweets(), get_timeline(), get_followers(), or get_favorites() in an interactive session an authorize via web browser popup on behalf of your Twitter account!

It is no longer necessary to obtain a developer account and create your own Twitter application to use Twitter’s API. You may still choose to do this (gives you more stability and permissions), but {rtweet} should work out of the box assuming (a) you are working in an interactive/live session of R and (b) you have installed the {httpuv} package.

diff --git a/docs/reference/get_followers.html b/docs/reference/get_followers.html index c4df349b..88f1b19d 100644 --- a/docs/reference/get_followers.html +++ b/docs/reference/get_followers.html @@ -224,6 +224,10 @@

Details reset. Users should monitor and test this before making especially large calls as any systematic issues could create sizable inefficiencies.

+

At this time, results are ordered with the most recent following first — + however, this ordering is subject to unannounced change and eventual + consistency issues. While this remains true it is possible iteratively build + follower lists for a user over time.

See also

diff --git a/docs/reference/get_friends.html b/docs/reference/get_friends.html index b27739f4..a1f621e6 100644 --- a/docs/reference/get_friends.html +++ b/docs/reference/get_friends.html @@ -229,6 +229,10 @@

Details for a second time) until the next rate limit reset. Users should monitor and test this before making especially large calls as any systematic issues could create sizable inefficiencies.

+

At this time, results are ordered with the most recent following first — + however, this ordering is subject to unannounced change and eventual + consistency issues. While this remains true it is possible iteratively build + friends lists for a user over time.

See also

diff --git a/docs/reference/round_time.html b/docs/reference/round_time.html index ded8eff5..c4fe4b59 100644 --- a/docs/reference/round_time.html +++ b/docs/reference/round_time.html @@ -167,7 +167,7 @@

Value

Examples

## class posixct -round_time(Sys.time(), "12 hours")
#> [1] "2019-04-30 12:00:00 UTC"
+round_time(Sys.time(), "12 hours")
#> [1] "2019-05-01 12:00:00 UTC"
## class date unique(round_time(seq(Sys.Date(), Sys.Date() + 100, "1 day"), "weeks"))
#> [1] "2019-04-25" "2019-05-02" "2019-05-09" "2019-05-16" "2019-05-23" #> [6] "2019-05-30" "2019-06-06" "2019-06-13" "2019-06-20" "2019-06-27" diff --git a/man/post_tweet.Rd b/man/post_tweet.Rd index 4144de71..1d6b517a 100644 --- a/man/post_tweet.Rd +++ b/man/post_tweet.Rd @@ -7,33 +7,32 @@ \usage{ post_tweet(status = "my first rtweet #rstats", media = NULL, token = NULL, in_reply_to_status_id = NULL, destroy_id = NULL, - retweet_id = NULL) + retweet_id = NULL, auto_populate_reply_metadata = FALSE) } \arguments{ -\item{status}{Character, tweet status. Must be 140 -characters or less.} +\item{status}{Character, tweet status. Must be 280 characters or less.} -\item{media}{File path to image or video media to be -included in tweet.} +\item{media}{File path to image or video media to be included in tweet.} -\item{token}{OAuth token. By default \code{token = NULL} -fetches a non-exhausted token from an environment -variable tokens.} +\item{token}{OAuth token. By default \code{token = NULL} fetches a +non-exhausted token from an environment variable tokens.} \item{in_reply_to_status_id}{Status ID of tweet to which you'd like to reply. Note: in line with the Twitter API, this parameter is ignored unless the author of the tweet this parameter references is mentioned within the status text.} -\item{destroy_id}{To delete a status, supply the single status ID here. -If a character string is supplied, overriding the default (NULL), -then a destroy request is made (and the status text and media attachments) -are irrelevant.} +\item{destroy_id}{To delete a status, supply the single status ID here. If a +character string is supplied, overriding the default (NULL), then a destroy +request is made (and the status text and media attachments) are irrelevant.} -\item{retweet_id}{To retweet a status, supply the single status ID here. -If a character string is supplied, overriding the default (NULL), -then a retweet request is made (and the status text and media attachments) -are irrelevant.} +\item{retweet_id}{To retweet a status, supply the single status ID here. If a +character string is supplied, overriding the default (NULL), then a retweet +request is made (and the status text and media attachments) are irrelevant.} + +\item{auto_populate_reply_metadata}{If set to TRUE and used with +in_reply_to_status_id, leading @mentions will be looked up from the +original Tweet, and added to the new Tweet from there. Defaults to FALSE.} } \description{ Posts status update to user's Twitter account