upgraded fixed_redditor() to praw 4.3
This commit is contained in:
parent
a0082fb3b1
commit
6e0fe2ec90
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
import pprint
|
||||||
import praw
|
import praw
|
||||||
|
|
||||||
from i3pystatus import IntervalModule
|
from i3pystatus import IntervalModule
|
||||||
@ -112,7 +112,8 @@ class Reddit(IntervalModule):
|
|||||||
def get_redditor(self, reddit):
|
def get_redditor(self, reddit):
|
||||||
redditor_info = {}
|
redditor_info = {}
|
||||||
if self.username:
|
if self.username:
|
||||||
u = reddit.get_redditor(self.username)
|
u = reddit.redditor(self.username)
|
||||||
|
pprint.pprint(u.link_karma)
|
||||||
redditor_info["link_karma"] = u.link_karma
|
redditor_info["link_karma"] = u.link_karma
|
||||||
redditor_info["comment_karma"] = u.comment_karma
|
redditor_info["comment_karma"] = u.comment_karma
|
||||||
else:
|
else:
|
||||||
@ -151,12 +152,12 @@ class Reddit(IntervalModule):
|
|||||||
fdict = {}
|
fdict = {}
|
||||||
subreddit_dict = {}
|
subreddit_dict = {}
|
||||||
if self.subreddit:
|
if self.subreddit:
|
||||||
s = reddit.get_subreddit(self.subreddit)
|
s = reddit.subreddit(self.subreddit)
|
||||||
else:
|
else:
|
||||||
s = reddit
|
s = reddit
|
||||||
if self.sort_by == 'hot':
|
if self.sort_by == 'hot':
|
||||||
if not self.subreddit:
|
if not self.subreddit:
|
||||||
subreddit_dict = vars(next(s.get_front_page(limit=1)))
|
subreddit_dict = vars(next(s.get_front(limit=1)))
|
||||||
else:
|
else:
|
||||||
subreddit_dict = vars(next(s.get_hot(limit=1)))
|
subreddit_dict = vars(next(s.get_hot(limit=1)))
|
||||||
elif self.sort_by == 'new':
|
elif self.sort_by == 'new':
|
||||||
@ -193,3 +194,8 @@ class Reddit(IntervalModule):
|
|||||||
|
|
||||||
def open_link(self):
|
def open_link(self):
|
||||||
user_open(self._url)
|
user_open(self._url)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
reddit = Reddit()
|
||||||
|
reddit.username = "stay_at_home_daddy"
|
||||||
|
pprint.pprint(reddit.get_redditor(reddit.connect()))
|
||||||
|
Loading…
Reference in New Issue
Block a user