Reputation: 31
I understand authentication requirements for accessing the Twitter API have recently changed. The following code results in: Error in function (type, msg, asError = TRUE) : Failed to connect to api.twitter.com port 443: Timed out
Related answers' suggested code has been used. Wondering if they address the API access requirements changes.
library(twitteR)
library(devtools)
library(ROAuth)
library(RCurl)
download.file(url="http://curl.haxx.se/ca/cacert.pem",
destfile="cacert.pem")
requestURL <- "https://api.twitter.com/oauth/request_token"
accessURL <- "https://api.twitter.com/oauth/access_token"
authURL <- "https://api.twitter.com/oauth/authorize"
consumerKey <- "xxxxxxxxxxxxxxxxxxxx"
consumerSecret <- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
twitCred <- OAuthFactory$new(consumerKey=consumerKey,
consumerSecret=consumerSecret,
requestURL=requestURL,
accessURL=accessURL,
authURL=authURL)
twitCred$handshake(cainfo="cacert.pem")
Thanks.
Upvotes: 1
Views: 2114
Reputation: 1589
currently
> api_key <- "-redacted-"
> api_secret <- "-redacted-"
> access_token <-"-redacted-"
> access_token_secret <- "-redacted-"
setup_twitter_oauth(api_key,api_secret,access_token,access_token_secret)
is in vogue.
Should you encounter any errors , please go ahead with
setup_twitter_oauth(consumer_key='your key' , consumer_secret= 'your secret ')
this should open up browser authentication. Hope it helps! Thanks
Upvotes: 1
Reputation: 31
Turns out it is a proxy server getting in my way. Running this code outside the LAN environment works just fine.
Upvotes: 2