This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Listener(StreamListener): | |
def __init__(self, api=None): | |
# This method used to define what needs to be done | |
# before the class can be actually used | |
# In our case, we're making sure the api is set up | |
# and loading the values we need for our tests | |
self.api = api or tweepy.API() | |
self.domains = load_domains() | |
self.twitter_accounts = load_twitter_accounts() | |
# simple proof of concept | |
def on_status(self, status): | |
# This is the method the processes the statuses | |
# sent by twitter, in our case we want to check | |
# the statuses against our tests | |
if self.domain_test(status=status): | |
# This is the function we want to call in | |
# when we find a match :) | |
twitter_hit(status) | |
if self.user_mention(status=status): | |
# This is the function we want to call in | |
# when we find a match :) | |
twitter_hit(status) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment