DO Know
DO Know

Reputation: 73

what is the difference between "def on_data(self, data):" and "def on_status(self, status):" in tweepy streamListener?

what is the difference between "def on_data(self, data):" and "def on_status(self, status):" in tweepy streamListener ?

hi, in the tweepy documentation they use def on_status for streaming:

import tweepy
class MyStreamListener(tweepy.StreamListener):
    def on_status(self, status):
    print(status.text)

But this tutorial use def on_data for streaming:

from tweepy import Stream
from tweepy.streaming import StreamListener

class MyListener(StreamListener):
    def on_data(self, data):

what is the difference?

Upvotes: 0

Views: 1511

Answers (1)

OneCricketeer
OneCricketeer

Reputation: 191874

Read the first link. The "difference" is that one happens before the other.

The on_data method of Tweepy’s StreamListener conveniently passes data from statuses to the on_status method.

Upvotes: 0

Related Questions