You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
|
|
|
import praw
|
|
|
|
from suchwow import config
|
|
|
|
|
|
|
|
|
|
|
|
class Reddit(object):
|
|
|
|
def __init__(self):
|
|
|
|
self.reddit = praw.Reddit(
|
|
|
|
client_id=config.PRAW_CLIENT_ID,
|
|
|
|
client_secret=config.PRAW_CLIENT_SECRET,
|
|
|
|
user_agent=config.PRAW_USER_AGENT,
|
|
|
|
username=config.PRAW_USERNAME,
|
|
|
|
password=config.PRAW_PASSWORD
|
|
|
|
)
|
|
|
|
self.subreddit = "wownero"
|
|
|
|
|
|
|
|
def post(self, title, url):
|
|
|
|
try:
|
|
|
|
submission = self.reddit.subreddit(self.subreddit).submit(
|
|
|
|
title=title,
|
|
|
|
url=url,
|
|
|
|
resubmit=False,
|
|
|
|
)
|
|
|
|
return submission
|
|
|
|
except:
|
|
|
|
return False
|
|
|
|
|
|
|
|
def comment(self, submission, comment):
|
|
|
|
try:
|
|
|
|
_comment = submission.reply(comment)
|
|
|
|
return _comment
|
|
|
|
except:
|
|
|
|
return False
|