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

一笑奈何 提交于 2019-12-05 23:38:24

问题


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!


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/31054656/what-is-the-difference-between-on-data-and-on-status-in-the-tweepy-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!