2

我是 twitteR 包的新手,我想知道导致以下错误消息的原因以及解决方法

  Error in twInterfaceObj$doAPICall(cmd, params, method, ...) : 
  Error: Client Error (429)

供您参考,以下是我的代码:

# load the required packages
library(twitteR)
library(RJSONIO)

#Authorize with Twitter's API
reqURL <- "https://api.twitter.com/oauth/request_token"
accessURL <- "http://api.twitter.com/oauth/access_token"
authURL <- "http://api.twitter.com/oauth/authorize"
consumerKey = "" 
consumerSecret = ""
twitCred <- OAuthFactory$new(consumerKey=consumerKey,
                         consumerSecret=consumerSecret,
                         requestURL=reqURL,
                         accessURL=accessURL,
                         authURL=authURL)
twitCred$handshake()

registerTwitterOAuth(twitCred)

B<-read.csv("BCorp RAW.csv") 
#Pull in raw B-Corp data where raw = no excel-based calculated   variables
handles<-B$Twitter.handle
handles<-na.omit(handles)

for(i in 1:length(handles)) {
   start<-getUser(handles[i])
   friends.object<-lookupUsers(start$getFriendIDs())
   followers.object<-lookupUsers(start$getFollowerIDs())
   friends <- sapply(friends.object,id)
   followers <- sapply(followers.object,id) 
   relations <- merge(data.frame(User=start$id, Follower=nfriends), 
                      data.frame(User=nfollowers, Follower=start$id), all=T)
   filename <- paste(handles[i],"twitter network.csv", sep=' ')
   setwd("/Users/mgrimes/Google Drive Work/B Corp Project/R/Twitter")
   write.csv(relations, file=filename)
   remove(relations)
}
4

0 回答 0