<commit_before>#! /usr/bin/env python
# -*- coding: utf-8 -*-

# fetch.py
#
# You can use this script with cron, for example:
#  */30 * * * * cd ~/.pyaggr3g470r/ ; python fetch.py
# to fetch articles every 30 minutes.
import sys
import bootstrap
from pyaggr3g470r import crawler
from pyaggr3g470r.models import User

if __name__ == "__main__":
    # Point of entry in execution mode
    try:
        feed_id = int(sys.argv[2])
    except:
        feed_id = None

    users = []
    try:
        users = User.query.filter(User.email == sys.argv[1]).all()
    except:
        users = User.query.all()

    for user in users:
        print "Fetching articles for", user.nickname
        feed_getter = crawler.FeedGetter(user.email)
        feed_getter.retrieve_feed(feed_id)
<commit_msg>Do not fetch articles for blocked users.<commit_after>#! /usr/bin/env python
# -*- coding: utf-8 -*-

# fetch.py
#
# You can use this script with cron, for example:
#  */30 * * * * cd ~/.pyaggr3g470r/ ; python fetch.py
# to fetch articles every 30 minutes.
import sys
import bootstrap
from pyaggr3g470r import crawler
from pyaggr3g470r.models import User

if __name__ == "__main__":
    # Point of entry in execution mode
    try:
        feed_id = int(sys.argv[2])
    except:
        feed_id = None

    users = []
    try:
        users = User.query.filter(User.email == sys.argv[1]).all()
    except:
        users = User.query.all()

    for user in users:
        if user.activation_key == "":
            print "Fetching articles for", user.nickname
            feed_getter = crawler.FeedGetter(user.email)
            feed_getter.retrieve_feed(feed_id)

{'fraction_non_alphanumeric': 0.1148936170212766, 'fraction_numerical': 0.023100303951367782, 'mean_word_length': 2.5860566448801743, 'pattern_counts': {'":': 3, '<': 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': '7158393', 'n_tokens_mistral': 565, 'n_tokens_neox': 543, 'n_words': 154}