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
tweet something that matches the filter "this is a test of the mykeyword filter"
wait a long time (I waited several minutes as a test), no output is displayed by my application
tweet something else that matches the filter "this is a second mykeyword filter test"
the first tweet is output almost immediately (within a second)
tweet something else right away that matches the filter "this is a third mykeyword filter test"
the second tweet is output almost immediately
continue steps 6 and 7 to see immediate results
It is almost as if the tweets are received immediately, they push out the last tweet that was received, but that newest tweet itself is not passed to the iterator and it just sits there waiting for something else to come in before it is able to be processed.
The text was updated successfully, but these errors were encountered:
I was able to confirm the issue. The last link you sited regarding buffer sizes was spot on. The default buffer (for streaming) is 512 bytes. Setting this to 1 byte fixes the issue. This fix is in the latest TwitterAPI release (2.1.13). However, it is not great for efficiency. A better solution is to use Twitter's "delimited" parameter for streaming endpoints. I probably will add this in a future release. Regardless, should be good now.
I am using the following pattern to process tweets in real-time:
r = api.request('statuses/filter', {'track': 'mykeyword'})
for item in r.get_iterator():
print item
I am using the latest version of TwitterAPI available on PIP (2.1.9)
Whenever a keyword is tweeted, within about a second the last tweet that matched the filter is printed on the screen. I found a similar report from another python Twitter Streaming API library where they seem to have found a solution: http://stackoverflow.com/questions/10083936/streaming-api-with-tweepy-only-returns-second-last-tweet-and-not-the-immediately
I'll lay out an example of what is happening:
It is almost as if the tweets are received immediately, they push out the last tweet that was received, but that newest tweet itself is not passed to the iterator and it just sits there waiting for something else to come in before it is able to be processed.
The text was updated successfully, but these errors were encountered: