class StdOutListener(StreamListener):

    def __init__(self, api=None):
        super(StdOutListener, self).__init__()
self.num_tweets = 0

def on_data(self, data):
    if status.author.location and 'New York' in status.author.location:
        self.num_tweets += 1
print(data)
if self.num_tweets < 5:
    return True
else:
    pass
Scrape tweets by tweet location and user location