From 169b0a767d421b7ecb0d7b43ac6662ee550dc95f Mon Sep 17 00:00:00 2001 From: Jason Haas Date: Wed, 25 Nov 2015 16:52:15 -0500 Subject: [PATCH] Minor tweaks to make code more modular --- traptor/traptor.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/traptor/traptor.py b/traptor/traptor.py index 82761d8..5dfea9a 100644 --- a/traptor/traptor.py +++ b/traptor/traptor.py @@ -96,6 +96,7 @@ def create_kafka_producer(kafka_hosts=KAFKA_HOSTS, kafka_topic=KAFKA_TOPIC): def create_birdy_stream(rules, + apikeys=APIKEYS, traptor_type=TRAPTOR_TYPE, traptor_id=TRAPTOR_ID, ): @@ -132,15 +133,14 @@ def create_birdy_stream(rules, logger.critical('That traptor type has not been implemented yet') sys.exit(3) +def tweet_time_to_iso(tweet_time): + return parser.parse(tweet_time).isoformat() def clean_tweet_data(tweet_dict): """ Do any pre-processing to raw tweet data before passing on to Kafka """ - def tweet_time_to_iso(tweet_time): - return parser.parse(tweet_time).isoformat() - if tweet_dict.get('created_at'): tweet_dict['created_at'] = tweet_time_to_iso(tweet_dict['created_at']) return tweet_dict @@ -168,7 +168,7 @@ def run(test): # Iterate through the twitter results for _data in birdyclient.stream(): - # logger.debug('Raw Data: {0}'.format(json.dumps(_data))) + logger.debug('Raw Data: {0}'.format(json.dumps(_data))) # Do tweet data pre-processing data = clean_tweet_data(_data)