# Path: malware_crawl/defaults.py
# REQUESTS_SESSIONS = {
#     "api": requests.Session(),
#     "probe": requests.Session()
# }


import tweepy
import re
import feedparser
import subprocess
import redis
from six.moves import map
from celery import task
from malware_crawl.defaults import redis_db, REQUESTS_SESSIONS
    )

    expand = subprocess.Popen(
        ['aspell', '-l', 'en', 'expand'],
        stdin=dump.stdout,
        stdout=subprocess.PIPE,
    )

    dump.stdout.close()
    return expand.communicate()[0].split('\n')


def update_aspell():
    word_list = load_aspell()
    print len(word_list)
    pipe = redis_db["master"].pipeline(use_transaction=True)
    pipe.delete(ASPELL_KEY)

    pipe.sadd(ASPELL_KEY, *word_list)

    pipe.execute()


@task
def control_trends():
    try:
        return redis_db["slave"].srandmember(ASPELL_KEY, 10)
    except redis.ResponseError:
        members = set()
        while len(members) < 10:

# Path: malware_crawl/defaults.py
# REQUESTS_SESSIONS = {
#     "api": requests.Session(),
#     "probe": requests.Session()
# }


# Path: malware_crawl/source.py
import tweepy
import re
import feedparser
import subprocess
import redis
from six.moves import map
from celery import task
from malware_crawl.defaults import redis_db, REQUESTS_SESSIONS

    )

    expand = subprocess.Popen(
        ['aspell', '-l', 'en', 'expand'],
        stdin=dump.stdout,
        stdout=subprocess.PIPE,
    )

    dump.stdout.close()
    return expand.communicate()[0].split('\n')


def update_aspell():
    word_list = load_aspell()
    print len(word_list)
    pipe = redis_db["master"].pipeline(use_transaction=True)
    pipe.delete(ASPELL_KEY)

    pipe.sadd(ASPELL_KEY, *word_list)

    pipe.execute()


@task
def control_trends():
    try:
        return redis_db["slave"].srandmember(ASPELL_KEY, 10)
    except redis.ResponseError:
        members = set()
        while len(members) < 10:

            members.add(redis_db["slave"].srandmember(ASPELL_KEY))