Ejemplo n.º 1
0
    def run(self):
        print "Thread Listener"

        self.stream = Stream()

        try:
            self.stream.connect()
        except urllib2.URLError:
            print "Thread Listener: Error connecting to Twitter API"
            self.request_termination()

        # Got the stream successfully. Let's get down to business
        else:
            try:
                # Going to do some actual work
                self.work()
            except (EOFError, IOError):
                self.request_termination()

        print "Thread Listener: Terminating"