You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 10, 2024. It is now read-only.
I have been using some code to output a dataframe containing some tweet information from get_timeline() using an input of a vector of Twitter user_ids (see bottom of the post for the code). Essentially the program checks to make sure I have enough requests left before continuing (17 is needed when n= 3200). I also have a tryCatch() in case some accounts are protected or have no tweets, etc.. It has been working for weeks producing results from dozens of vectors containing 500 user ids without producing a single error.
However, today it started producing this error at random (I checked to see if it was happening around a certain user id, but that is not the case). This type of error I am receiving is identical to the one described in Issue #266 opened a week ago.
Attempt 1: (The top numbers are the number of requests I have left)
...
Moreover as soon as the error popped up, I used (rate_limit('get_timeline')) immediately and there was 422 requests as I expected (using 16 requests is common for one user). My rate limit had clearly not been exceeded, and as shown through my trials the error happens at random times.
# A tibble: 1 x 7querylimitremainingresetreset_attimestampapp<chr><int><int><time><dttm><dttm><chr>1statuses/user_timeline9004226.007346550623582018-07-0818:34:142018-07-0818:28:14NetworkVoyager2
I guess I just need add some sort of exception for this error, but if anybody has any other suggestions that would be appreciated.
My Code.
#my codetweet_extractor<-function(users){
output_list<-list()
for (iin1:length(users)) {
rl<- rate_limit('get_timeline')
message(rl$remaining)
if (rl$remaining<20){
message("Waiting for ", rl$reset, " minutes for rate reset!")
Sys.sleep(as.numeric(rl$reset, "secs"))
}
output_list[[i]] <- tryCatch(
{get_timeline(users[i], n=3200)[,c(1,3,15)]},
error=function(e){return_nothing()},
warning=function(w){suppressWarnings(return_nothing())}
)
}
output= do.call(rbind, output_list)
return(output)
}
Here is the vector of users I was using in case someone really wants to try and replicate it
"I have figured out what your problem was. There is a rate limit on the number of times you can use rate_limit(), which is 180. If you call rate_limit() and look at the 11th row you will see it. This is what it looks like for me.
I have been using some code to output a dataframe containing some tweet information from get_timeline() using an input of a vector of Twitter user_ids (see bottom of the post for the code). Essentially the program checks to make sure I have enough requests left before continuing (17 is needed when n= 3200). I also have a tryCatch() in case some accounts are protected or have no tweets, etc.. It has been working for weeks producing results from dozens of vectors containing 500 user ids without producing a single error.
However, today it started producing this error at random (I checked to see if it was happening around a certain user id, but that is not the case). This type of error I am receiving is identical to the one described in Issue #266 opened a week ago.
Attempt 1: (The top numbers are the number of requests I have left)
...
This happened 396 users into my vector.
Attempt 2: (The top numbers are the number of requests I have left)
...
This happened 70 users into my vector.
Moreover as soon as the error popped up, I used (rate_limit('get_timeline')) immediately and there was 422 requests as I expected (using 16 requests is common for one user). My rate limit had clearly not been exceeded, and as shown through my trials the error happens at random times.
I guess I just need add some sort of exception for this error, but if anybody has any other suggestions that would be appreciated.
My Code.
Here is the vector of users I was using in case someone really wants to try and replicate it
The text was updated successfully, but these errors were encountered: