<commit_before>import json
from tweepy import Stream
from tweepy import OAuthHandler
from tweepy.streaming import StreamListener
import time
from pymongo import MongoClient
from requests.packages.urllib3.exceptions import ProtocolError

with open('auth.json') as auth_file:
    auth_data = json.load(auth_file)

ckey = auth_data['ckey']
csecret = auth_data['csecret']
atoken = auth_data['atoken']
asecret = auth_data['asecret']

client = MongoClient('localhost', 27017)
db = client['election-2016']
tweets_test = db['tweets_test']

class StdOutListener(StreamListener):

    def __init__(self):
        self.switcher = 1

    def on_data(self, data):
        if (self.switcher % 3  == 1):

            tweet = json.loads(data)
            print(tweet['id_str'])
            tweets_test.insert_one(tweet)
            self.switcher += 1<commit_msg>reduce tweet count to 1/4<commit_after>import json
from tweepy import Stream
from tweepy import OAuthHandler
from tweepy.streaming import StreamListener
import time
from pymongo import MongoClient
from requests.packages.urllib3.exceptions import ProtocolError

with open('auth.json') as auth_file:
    auth_data = json.load(auth_file)

ckey = auth_data['ckey']
csecret = auth_data['csecret']
atoken = auth_data['atoken']
asecret = auth_data['asecret']

client = MongoClient('localhost', 27017)
db = client['election-2016']
tweets_test = db['tweets_test']

class StdOutListener(StreamListener):

    def __init__(self):
        self.switcher = 0

    def on_data(self, data):
        if (self.switcher % 4  == 0):

            tweet = json.loads(data)
            print(tweet['id_str'])
            tweets_test.insert_one(tweet)
            self.switcher += 1
{'fraction_non_alphanumeric': 0.10504694835680752, 'fraction_numerical': 0.017605633802816902, 'mean_word_length': 3.8714285714285714, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7353212', 'n_tokens_mistral': 579, 'n_tokens_neox': 554, 'n_words': 131}