Merge pull request #72 from x89/71-clear_vote_archived_submissions

#71 This should skip clearing votes on subs > 6m old
praw4
David 8 years ago committed by GitHub
commit 5302bc2668

@ -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:
item.clear_vote() try:
self._api_calls.append(int(time.time())) item.clear_vote()
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