I'd import 'tweepy' package for accessing twitter data for analysis and visualization in Python. Afterwards I did setup oauth authentication and everything else but on the next step, which is STREAMING TWEETS for me am using MyStreamListener. This causing me a Name Error--
NameError: name 'MyStreamListener' is not defined
Here's my code-
# API Authentication # Importing TWEEPY Library import tweepy # Store OAuth authentication credentials in relevant variables access_token = "provided" access_token_secret = "provided" consumer_key = "provided" consumer_secret = "provided" # Pass OAuth details to tweepy's OAuth handler auth = tweepy.OAuthHandler(consumer_key, consumer_secret) auth.set_access_token(access_token, access_token_secret) # Streaming Tweets # Initialize Stream listener l = MyStreamListener() # Create you Stream object with authentication stream = tweepy.Stream(auth, l) # Filter Twitter Streams to capture data by the keywords: stream.filter(track = ['clinton', 'trump', 'sanders', 'cruz'])
What should I do now? Any thoughts? Cheers!