Beispiel #1
0
def monitor_comments():
    from myapp.config import config
    from myapp.lib.monitor import Monitor
    make_app()
    username = config.get('Reddit', 'username')
    password = config.get('Reddit', 'password')
    m = Monitor(username=username, password=password, delay=10)
    m.monitor_comments()
Beispiel #2
0
 def __init__(self):
     local.application = self
     user = config.get('Database', 'user')
     pw   = config.get('Database', 'pw')
     host = config.get('Database', 'host')
     db   = config.get('Database', 'db')
     db_uri = 'postgres://%s:%s@%s/%s' % (user, pw, host, db)
     self.database_engine = create_engine(db_uri, convert_unicode=True)
Beispiel #3
0
def update():
    from myapp.config import config
    from myapp.lib.spider import Spider
    make_app()
    username = config.get('Reddit', 'username')
    password = config.get('Reddit', 'password')
    spider = Spider(username=username, password=password)
    log_email([spider.analyse_all], 'spider.log')
Beispiel #4
0
def logos():
    from myapp.config import config
    from myapp.lib.logos import Logos
    make_app()
    username = config.get('Reddit', 'username')
    password = config.get('Reddit', 'password')
    l = Logos(username=username, password=password)
    l.get()
Beispiel #5
0
 def __init__(self):
     local.application = self
     user = config.get('Database', 'user')
     pw = config.get('Database', 'pw')
     host = config.get('Database', 'host')
     db = config.get('Database', 'db')
     db_uri = 'postgres://%s:%s@%s/%s' % (user, pw, host, db)
     self.database_engine = create_engine(db_uri, convert_unicode=True)
Beispiel #6
0
def update():
    from myapp.config import config
    from myapp.lib.spider import Spider

    make_app()
    username = config.get("Reddit", "username")
    password = config.get("Reddit", "password")
    spider = Spider(username=username, password=password)
    log_email([spider.analyse_all], "spider.log")
Beispiel #7
0
def logos():
    from myapp.config import config
    from myapp.lib.logos import Logos

    make_app()
    username = config.get("Reddit", "username")
    password = config.get("Reddit", "password")
    l = Logos(username=username, password=password)
    l.get()
Beispiel #8
0
def monitor_posts():
    from myapp.config import config
    from myapp.lib.monitor import Monitor

    make_app()
    username = config.get("Reddit", "username")
    password = config.get("Reddit", "password")
    m = Monitor(username=username, password=password, delay=150)
    m.monitor_posts()
Beispiel #9
0
def spider():
    from myapp.config import config
    from myapp.lib.spider import Spider
    make_app()
    username = config.get('Reddit', 'username')
    password = config.get('Reddit', 'password')
    spider = Spider(username=username, password=password)
    log_email([spider.get_new, spider.analyse_new], 'spider.log')
    fix_relative_links()
Beispiel #10
0
def spider():
    from myapp.config import config
    from myapp.lib.spider import Spider

    make_app()
    username = config.get("Reddit", "username")
    password = config.get("Reddit", "password")
    spider = Spider(username=username, password=password)
    log_email([spider.get_new, spider.analyse_new], "spider.log")
    fix_relative_links()
Beispiel #11
0
def _login():
    key = _hash("reddit_login_headers")
    cached = cache.get(key)
    if cached:
        return cached
    username = config.get("Reddit", "username")
    password = config.get("Reddit", "password")
    http = httplib2.Http()
    url = "http://www.reddit.com/api/login/" + username
    body = {"user": username, "passwd": password}
    headers = {"Content-type": "application/x-www-form-urlencoded"}
    response, content = http.request(url, "POST", headers=headers, body=urllib.urlencode(body))
    headers = {"Cookie": response["set-cookie"]}
    cache.set(key, headers, timeout=24 * 60 * 60)
    return headers
Beispiel #12
0
def _login():
    key = _hash('reddit_login_headers')
    cached = cache.get(key)
    if cached:
        return cached
    username = config.get('Reddit', 'username')
    password = config.get('Reddit', 'password')
    http = httplib2.Http()
    url = 'http://www.reddit.com/api/login/' + username
    body = {'user': username, 'passwd': password}
    headers = {'Content-type': 'application/x-www-form-urlencoded'}
    response, content = http.request(url,
                                     'POST',
                                     headers=headers,
                                     body=urllib.urlencode(body))
    headers = {'Cookie': response['set-cookie']}
    cache.set(key, headers, timeout=24 * 60 * 60)
    return headers