-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreddit.py
36 lines (28 loc) · 904 Bytes
/
reddit.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
"""
reddit
A package for getting content off reddit, and sometimes putting it there
@category silly
@version $ID: 1.1.1, 2015-02-19 17:00:00 CST $;
@author KMR, Jason
@licence GNU GPL v.3
"""
import praw
import db_interface
class reddit:
rAPI = None
post = None
def __init__(self, conf):
user_agent = ("A858 Imagerator")
self.rAPI = praw.Reddit(user_agent=user_agent)
self.rAPI.login(username=conf['u'], password=conf['p'])
def get_subreddit(self, sub):
return self.rAPI.get_subreddit(sub)
def haventReplied(self, sub):
if db_interface.getSub( sub.id ) is None:
return True
return False
def getSubText(self, sub):
return sub.selftext
def postComment(self, sub, imgLink):
sub.add_comment("{}\n\n I am A8582Image, I make images.".format(imgLink))
db_interface.addSub(sub.id)