Hi
I am new in this web site, I have a university projecte I want to stream tweet for Algerien peaples.
I used the following code to stream tweets as a primary step, but I get no thing whith this code, please what is wrong whith my code can you help me
in commande line I do python streaming.py > test.txt
it give me no error but the test.txt is empty
i use ubuntu and python 2.7
thank a lot
CODE
from tweepy.streaming import StreamListener
from tweepy import OAuthHandler
from tweepy import Stream
consumer_key = ’ '
consumer_secret = ’ ’
access_token = ’ ‘
access_token_secret=’ ’
class StdOutListener(StreamListener):
def on_data(self, data):
print (data)
return True
def on_error(self, status):
print (status)
if name == ‘main’:
l = StdOutListener()
auth = OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
stream = Stream(auth, l)
stream.filter(track=['algerie'])