Should I be using the REST or Streaming API?


#1

My application (@whattrackis) replies to uses with a prediction of what track a train will depart from. Currently, I am using the REST API through Tweepy in Python.

The program runs every minute via crontab to ensure it does not incur a 429 error, but lately I have been getting a few of those 429/API Limit exceeded errors.

Given the few 429 errors I’ve received, and the fact that the program will eventually need to respond to more than one user and thus tweet more than once a minute, how might I do this within Twitter’s API limits. (I also want to add a feature to send the correct track if the prediction was wrong)

-Thanks!


#2

Tweepy is great. You should definitely use the streaming API to track Tweets to reply to. Using the streaming API will alleviate rate limit issues. However, to send Tweets you may incur rate limits depending how many inbound Tweets you need to reply to.

In general we do not increase rate limits to post Tweets to prevent spam. For a prototype application the limits should be sufficient. If you require elevated limits, you can request it here. Use cases are reviewed and not all requests will be granted. You should also familiarize yourself with our automation best practices and policies here.


#3

Thanks Jon. This is really helpful in understanding the difference between streaming vs rest. I think for the majority, sending Tweets will not be a great issue (assuming the number isn’t excessive). I also think it’s a good idea not to increase rate – as this will only empower spam users.

Appreciate the clarification on the topic.


#4

Thanks for the great response! I’m working on converting the code to check my ‘mentions’ for now and I’m having some trouble finding good documentation on Tweepy’s streaming API. I found an article from Twitter’s own developer blog, and some others, but there is no clear documentation of this section of the API.

Am I missing something?

Also where can I find a good place to figure out what “level of access” I might require should this application need elevated access from twitter?

-Thanks