Created
February 7, 2020 04:04
-
-
Save dev4Fun/fb47eb292dddb66847c1aa636bf7f734 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # bot.py | |
| def fetch_submission_ids(self, subreddit, **kwargs): | |
| return [submission.id for submission in self.reddit_client.subreddit(subreddit).hot(**kwargs)] | |
| def parse_submission(self, submission_id=None, url=None): | |
| try: | |
| submission = self.reddit_client.submission(id=submission_id, url=url) | |
| self._process_submission(submission) | |
| except Exception as ex: | |
| error_message = str(ex) | |
| self._retry_rate_limited_failure(error_message, self.parse_submission, submission_id) | |
| finally: | |
| dump_pickled(self.passed_submissions, f"submissions-{self.username}.pickle") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment