tweepy 库中的 on_data 和 on_status 有什么区别?
What is the difference between on_data and on_status in the tweepy library?
我刚开始使用 tweepy
库来连接 Twitter 的流媒体 api。我遇到了 StreamListener
class 的 on_status()
和 on_data()
方法。有什么不同?完全菜鸟!
on_data()
手数:
- 回复状态
- 删除
- 事件
- 私信
- 朋友
- 限制、断开连接和警告
而 on_status()
只是处理状态。
来源:https://github.com/tweepy/tweepy/blob/78d2883a922fa5232e8cdfab0c272c24b8ce37c4/tweepy/streaming.py
如果您只关心推文,请使用 on_status()
。这将在没有添加信息的情况下为您提供所需的内容,这样做不会妨碍您的限制。
如果您需要详细信息,请使用 on_data()
。 --除非您进行大量分析,否则很少出现这种情况。
我刚开始使用 tweepy
库来连接 Twitter 的流媒体 api。我遇到了 StreamListener
class 的 on_status()
和 on_data()
方法。有什么不同?完全菜鸟!
on_data()
手数:
- 回复状态
- 删除
- 事件
- 私信
- 朋友
- 限制、断开连接和警告
而 on_status()
只是处理状态。
来源:https://github.com/tweepy/tweepy/blob/78d2883a922fa5232e8cdfab0c272c24b8ce37c4/tweepy/streaming.py
如果您只关心推文,请使用 on_status()
。这将在没有添加信息的情况下为您提供所需的内容,这样做不会妨碍您的限制。
如果您需要详细信息,请使用 on_data()
。 --除非您进行大量分析,否则很少出现这种情况。