Set up .ini file for auth keys.

This commit is contained in:
mburtonkelly
2018-11-01 11:16:01 -05:00
parent 7ae6d2c4d4
commit c8dc23e462
2 changed files with 14 additions and 5 deletions

View File

@ -7,6 +7,7 @@ library(jsonlite)
library(rjson)
library(dplyr)
library(twitteR)
library(ini)
# Grab city view for Grand Forks
gfk <- rjson::fromJSON(file="https://www.publicstuff.com/api/2.1/city_view?space_id=15174")
@ -43,11 +44,14 @@ gfk_requests <- bind_rows(gfk_requests)
#### Tweeting
# https://rcrastinate.blogspot.com/2018/05/send-tweets-from-r-very-short.html
# Need to create an external file with keys so they don't end up on GitHub
setup_twitter_oauth(consumer_key = "<your Consumer Key>",
access_token = "<your Acces Token>",
consumer_secret = "<your Consumer Secret>",
access_secret = "<your Access Token Secret>")
# Read authentication values from ini file
# Don't commit real values to git!
auth <- read.ini("auth.ini")
setup_twitter_oauth(consumer_key = auth$twitter$consumer_key,
access_token = auth$twitter$access_token,
consumer_secret = auth$twitter$consumer_secret,
access_secret = auth$twitter$access_secret)
# After tweeting, write a small text file that has the last timestamp that was tweeted. Use that for grabbing future requests.