What is the difference between on_data and on_status in the tweepy library?

8.2k Views Asked by At

I just started using tweepy library to connect with streaming api of twitter. I encountered both on_status() and on_data() methods of the StreamListener class. What is the difference? Total noob here!

2

There are 2 best solutions below

1
On BEST ANSWER

on_data() handles:

  • replies to statuses
  • deletes
  • events
  • direct messages
  • friends
  • limits, disconnects and warnings

whereas, on_status() just handles statuses.

source: https://github.com/tweepy/tweepy/blob/78d2883a922fa5232e8cdfab0c272c24b8ce37c4/tweepy/streaming.py

0
On

If you're only concerned with tweets, use on_status(). This will give you what you needed without the added information and doing so will not hinder your limit.

If you want detailed information use on_data(). --That's rarely the case unless you're doing heavy analysis.