def init():
connection = MongoClient(secret.mongo_url, secret.mongo_port)
db = connection[secret.mongo_db]
db.authenticate(secret.mongo_user, urllib.quote_plus(secret.mongo_pass))
r = praw.Reddit(user_agent="Samachar Bot for /r/india by /u/sallurocks")
scopes = {u'edit', u'submit', u'read', u'privatemessages', u'identity', u'history'}
oauth_helper = PrawOAuth2Mini(r, app_key=secret.news_app_key,
app_secret=secret.news_app_secret,
access_token=secret.news_access_token,
refresh_token=secret.news_refresh_token, scopes=scopes)
init_object = {'db': db,
'reddit': r,
'oauth': oauth_helper,
'goose': Goose()}
return init_object
评论列表
文章目录