Newbie trying to deal with 420 error


I am a newbie and am trying to use streaming api to collect data. I am using python to collect this data?
I was playing with example code and all of the sudden I am getting 420 error code?

class StreamListener(tweepy.StreamListener):
def on_status(self, tweet):
print ‘Ran on_status’

def on_error(self, status_code):
    print 'Error: ' + repr(status_code)
    return False

def on_data(self, data):
    print 'Ok, this is actually running'

consumer_key = ""
consumer_secret = ""
access_token_key = ""
access_token_secret = “”

auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token_key, access_token_secret)

l = StreamListener()
streamer = tweepy.Stream(auth=auth, listener=l)
#setTerms = [‘hello’, ‘goodbye’, ‘goodnight’, ‘good morning’]
setTerms = [‘twitter’]
streamer.filter(track = setTerms)

What am I doing wrong?
Also, it seems that twitter keeps on changing its api’s quite frequently and most of the code /tutorial present online doesnt work?
But as a newbie, people tend to experiemnt with alot of these code before realizing that methods are deprecated.
And then you start seeing such “limit” errors … I guess it would be nice to see some “official” tutorials from twitter that works… or maybe i just missed the link…
Anyways… what am i doing wrong? and how do i resolve this?


what is a 420 error and how do you reply to threads in emails is there away you can put to send message