Let PRAW manage authentication

This commit is contained in:
Théo Piboubès
2015-09-01 22:32:56 +02:00
parent 314d2dbf26
commit f6546aaf75
6 changed files with 4 additions and 73 deletions

View File

@@ -314,9 +314,6 @@ class BasePage(object):
@BaseController.register('a')
def upvote(self):
# Refresh access token if expired
self.oauth.refresh()
data = self.content.get(self.nav.absolute_index)
try:
if 'likes' not in data:
@@ -332,9 +329,6 @@ class BasePage(object):
@BaseController.register('z')
def downvote(self):
# Refresh access token if expired
self.oauth.refresh()
data = self.content.get(self.nav.absolute_index)
try:
if 'likes' not in data:
@@ -372,9 +366,6 @@ class BasePage(object):
show_notification(self.stdscr, ['Not logged in'])
return
# Refresh access token if expired
self.oauth.refresh()
data = self.content.get(self.nav.absolute_index)
if data.get('author') != self.reddit.user.name:
curses.flash()
@@ -403,9 +394,6 @@ class BasePage(object):
show_notification(self.stdscr, ['Not logged in'])
return
# Refresh access token if expired
self.oauth.refresh()
data = self.content.get(self.nav.absolute_index)
if data.get('author') != self.reddit.user.name:
curses.flash()
@@ -440,9 +428,6 @@ class BasePage(object):
Checks the inbox for unread messages and displays a notification.
"""
# Refresh access token if expired
self.oauth.refresh()
inbox = len(list(self.reddit.get_unread(limit=1)))
try:
if inbox > 0: