def on_success(self, tweet): if 'text' in tweet: msg = tweet['text'].encode('utf-8') src = tweet['user']['screen_name'].encode('utf-8') tstamp = tweet['created_at'] logging.info('Tweet from @%s Date: %s Msg:%s' % (src, tstamp, msg)) telemetry = parse_tweet(msg) app.queue.append(telemetry) else: logging.warn('No DATA %s' % tweet)
def on_success(self, tweet): if 'text' in tweet: msg = str(tweet['text']) src = str(tweet['user']['screen_name']) tstamp = tweet['created_at'] logging.info('Tweet from @%s Date: %s Msg:%s' % (src, tstamp, msg)) telemetry = parse_tweet(msg) app.queue.append(telemetry) else: logging.warn('No DATA %s' % tweet)
def test_parse_many_parts_as_in_doc(self): record = parse_tweet('H09:49:12V39.75X29.35F43.34G15.45I25.78T26.34J54.555K-45.992L54.552M-45.989') self.assertEqual(record["battery_voltage"], 39.75)
def test_parse_two_parts(self): record = parse_tweet("V39.75I25.78") self.assertEqual(record["V"], 39.75) self.assertEqual(record["I"], 25.78)
def test_parse_two_parts(self): record = parse_tweet("V39.75I25.78") self.assertEqual(record["battery_voltage"], 39.75) self.assertEqual(record["output_current"], 25.78)