<commit_before>#!/usr/bin/env python2

import sys
import json # from json import loads, dumps
from urllib2 import urlopen, HTTPError
from time import sleep

f = open('user.json', 'r')
user = json.load(f)['user']
f.close()

sub_section = 'comments'
after = ''

init_url = 'http://www.reddit.com/user/{user}/comments/.json?after=%s'.format(user=user)
next_url = init_url % after

try:
    http = urlopen(next_url)
except HTTPError:
    raise HTTPError("You seem to have given an invalid user")

try:
    reddit = json.load(http)
except ValueError:
    raise ValueError("Failed to decode json.")

datum = []
while True:
    after = reddit['data']['after']
    children = reddit['data']['children']

    # This bit fills datum with the id (for removal) and the date (for saving recent posts)
    for child in children:
        child_data = child['data']
        if 'id' in child_data:
            datum.append({
                'id': child_data[u'id'],<commit_msg>grab by name instead of id<commit_after>#!/usr/bin/env python2

import sys
import json # from json import loads, dumps
from urllib2 import urlopen, HTTPError
from time import sleep

f = open('user.json', 'r')
user = json.load(f)['user']
f.close()

sub_section = 'comments'
after = ''

init_url = 'http://www.reddit.com/user/{user}/comments/.json?after=%s'.format(user=user)
next_url = init_url % after

try:
    http = urlopen(next_url)
except HTTPError:
    raise HTTPError("You seem to have given an invalid user")

try:
    reddit = json.load(http)
except ValueError:
    raise ValueError("Failed to decode json.")

datum = []
while True:
    after = reddit['data']['after']
    children = reddit['data']['children']

    # This bit fills datum with the id (for removal) and the date (for saving recent posts)
    for child in children:
        child_data = child['data']
        if 'id' in child_data:
            datum.append({
                'id': child_data[u'name'],
{'fraction_non_alphanumeric': 0.13229974160206717, 'fraction_numerical': 0.0020671834625322996, 'mean_word_length': 3.4814814814814814, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5942769', 'n_tokens_mistral': 615, 'n_tokens_neox': 630, 'n_words': 192}