This should skip clearing votes on subs > 6m old

71-clear_vote_archived_submissions
David John 8 years ago
parent 9bb446cb5c
commit e6c732f4df

@ -9,7 +9,8 @@ import praw
import time import time
from re import sub from re import sub
from datetime import datetime, timedelta from datetime import datetime, timedelta
from praw.errors import (InvalidUser, InvalidUserPass, RateLimitExceeded, HTTPException, OAuthAppRequired) from praw.errors import (InvalidUser, InvalidUserPass, RateLimitExceeded,
HTTPException, OAuthAppRequired)
from praw.objects import Comment, Submission from praw.objects import Comment, Submission
from shreddit.util import get_sentence from shreddit.util import get_sentence
@ -131,8 +132,11 @@ class Shredder(object):
if self._keep_a_copy and self._save_directory: if self._keep_a_copy and self._save_directory:
self._save_item(item) self._save_item(item)
if self._clear_vote: if self._clear_vote:
try:
item.clear_vote() item.clear_vote()
self._api_calls.append(int(time.time())) self._api_calls.append(int(time.time()))
except HTTPException:
self._logger.debug("Couldn't clear vote on {item}".format(item=item))
if isinstance(item, Submission): if isinstance(item, Submission):
self._remove_submission(item) self._remove_submission(item)
elif isinstance(item, Comment): elif isinstance(item, Comment):

Loading…
Cancel
Save