Fixes reconnect regression

pull/88/head
Scott 8 years ago
parent d9fc18a315
commit 705c076abc

@ -4,7 +4,7 @@ from setuptools import setup
from codecs import open from codecs import open
from os import path from os import path
VERSION = "6.0.3" VERSION = "6.0.4"
DESCRIPTION = " Remove your comment history on Reddit as deleting an account does not do so." DESCRIPTION = " Remove your comment history on Reddit as deleting an account does not do so."
here = path.abspath(path.dirname(__file__)) here = path.abspath(path.dirname(__file__))

@ -24,7 +24,8 @@ class Shredder(object):
self._logger.setLevel(level=logging.DEBUG if config.get("verbose", True) else logging.INFO) self._logger.setLevel(level=logging.DEBUG if config.get("verbose", True) else logging.INFO)
self.__dict__.update({"_{}".format(k): config[k] for k in config}) self.__dict__.update({"_{}".format(k): config[k] for k in config})
self._connect(user) self._user = user
self._connect()
if self._save_directory: if self._save_directory:
self._r.config.store_json_result = True self._r.config.store_json_result = True
@ -71,12 +72,12 @@ class Shredder(object):
# while and do it again. # while and do it again.
self._logger.info("Waiting {} seconds and continuing...".format(self._batch_cooldown)) self._logger.info("Waiting {} seconds and continuing...".format(self._batch_cooldown))
time.sleep(self._batch_cooldown) time.sleep(self._batch_cooldown)
self._connect(None, self._username, self._password) self._connect()
self.shred() self.shred()
def _connect(self, user): def _connect(self):
try: try:
self._r = praw.Reddit(user, user_agent="python:shreddit:v6.0.0") self._r = praw.Reddit(self._user, user_agent="python:shreddit:v6.0.4")
self._logger.info("Logged in as {user}.".format(user=self._r.user.me())) self._logger.info("Logged in as {user}.".format(user=self._r.user.me()))
except ResponseException: except ResponseException:
raise ShredditError("Bad OAuth credentials") raise ShredditError("Bad OAuth credentials")

Loading…
Cancel
Save