def on_data(self, tweet): f = testTweepy.functions() all_data = json.loads(tweet) text = all_data['text'] for each in self.nameOfCompany: if each[0].lower() in text.lower() or each[1].lower() in text.lower(): companyName = each[0] all_data['company'] = companyName all_data['timeTag'] = 'after' didSentimentTweet = f.sentiment(all_data) f.save_tweets(didSentimentTweet,self.db,"stream") return True
def on_data(self, tweet): f = testTweepy.functions() all_data = json.loads(tweet) text = all_data['text'] for each in self.nameOfCompany: if each[0].lower() in text.lower() or each[1].lower( ) in text.lower(): companyName = each[0] all_data['company'] = companyName all_data['timeTag'] = 'after' didSentimentTweet = f.sentiment(all_data) f.save_tweets(didSentimentTweet, self.db, "stream") return True
def on_data(self, tweet): try: print "find~~" f = testTweepy.functions() all_data = json.loads(tweet) if 'text' in all_data: text = all_data['text'] for each in self.nameOfCompany: if each[0].lower() in text.lower() or each[1].lower() in text.lower(): companyName = each[0] all_data['company'] = companyName all_data['timeTag'] = 'after' didSentimentTweet = f.sentiment(all_data) f.save_tweets(didSentimentTweet,self.db,"stream") print "saved find" return True else: print 'This does not have a text entry' except Exception,e: print "streaming exception"
def on_data(self, tweet): try: print "find~~" f = testTweepy.functions() all_data = json.loads(tweet) if 'text' in all_data: text = all_data['text'] for each in self.nameOfCompany: if each[0].lower() in text.lower() or each[1].lower( ) in text.lower(): companyName = each[0] all_data['company'] = companyName all_data['timeTag'] = 'after' didSentimentTweet = f.sentiment(all_data) f.save_tweets(didSentimentTweet, self.db, "stream") print "saved find" return True else: print 'This does not have a text entry' except Exception, e: print "streaming exception"