Beispiel #1
0
 def __init__(self):
     register_default_functions()
     StreamListener.__init__(self)
     try:
         self.username = settings.TWITTER_USERNAME
         self.password = settings.TWITTER_PASSWORD
     except AttributeError:
         print "TWITTER_USERNAME and TWITTER_PASSWORD not defined in private_settings.py"
         self.username = raw_input("Twitter username: "******"Twitter password: ")
     self.status_lock = RLock()
     self.statuses = []
     self.query_builder = gen_query_builder()
     self.stream = None
Beispiel #2
0
 def __init__(self):
     StreamListener.__init__(self)
     try:
         username = settings.TWITTER_USERNAME
         password = settings.TWITTER_PASSWORD
     except AttributeError:
         print "TWITTER_USERNAME and TWITTER_PASSWORD not defined in private_settings.py"
         username = raw_input("Twitter username: "******"Twitter password: ")
     self.status_lock = RLock()
     self.statuses = []
     self.query_builder = gen_query_builder()
     self.stream = Stream(
         username,
         password,
         self,  # this object implements StreamListener
         timeout=600,  # reconnect if no messages in 600s
         retry_count=20,  # try reconnecting 20 times
         retry_time=10.0,  # wait 10s if no HTTP 200
         snooze_time=1.0,
     )  # wait 1s if timeout in 600s