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()
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)
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')
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()
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")
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()
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()
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()
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()
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
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