Set up .ini file for auth keys.
This commit is contained in:
5
auth.ini
Normal file
5
auth.ini
Normal file
@ -0,0 +1,5 @@
|
||||
[twitter]
|
||||
consumer_key = <your Consumer Key>
|
||||
access_token = <your Acces Token>
|
||||
consumer_secret = <your Consumer Secret>
|
||||
access_secret = <your Access Token Secret>
|
@ -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.
|
||||
|
||||
|
Reference in New Issue
Block a user