def run_urs(self): """ Switch for running all URS tools. Calls previously defined public methods: PRAW validation: Validation.validate_user() PRAW scrapers: RunSubreddit.run() RunRedditor.run() RunComments.run() RunBasic.run() Analytical tools: GenerateFrequencies.generate() GenerateWordcloud.generate() """ if self._args.check: """ Run rate limit check. """ logging.info("RUNNING API CREDENTIALS CHECK.") logging.info("") Validation.validate_user(self._parser, self._reddit) elif self._args.subreddit or self._args.redditor or self._args.comments or self._args.basic: """ Run PRAW scrapers. """ Validation.validate_user(self._parser, self._reddit) if self._args.subreddit: RunSubreddit.run(self._args, self._parser, self._reddit) if self._args.redditor: RunRedditor.run(self._args, self._parser, self._reddit) if self._args.comments: RunComments.run(self._args, self._parser, self._reddit) elif self._args.basic: RunBasic.run(self._args, self._parser, self._reddit) elif self._args.frequencies or self._args.wordcloud: """ Run analytical tools. """ if self._args.frequencies: GenerateFrequencies.generate(self._args) if self._args.wordcloud: GenerateWordcloud.generate(self._args)
def test_validate_user(self): parser = MakeArgs.make_scraper_args() reddit = Login.create_reddit_object() try: Validation.validate_user(parser, reddit) assert True except: assert False
def run_urs(self): """ Switch for running all URS tools. Calls previously defined public methods: PRAW validation: Validation.validate_user() PRAW scrapers: RunSubreddit.run() RunRedditor.run() RunComments.run() RunBasic.run() PRAW livestream scrapers: Livestream.stream() Analytical tools: GenerateFrequencies.generate() GenerateWordcloud.generate() """ if self._args.check: """ Run rate limit check. """ logging.info("RUNNING API CREDENTIALS CHECK.") logging.info("") Validation.validate_user(self._parser, self._reddit) elif self._args.tree: """ Display visual directory tree for a date (default is the current date). """ DateTree.display_tree(self._args.tree) elif self._args.subreddit or self._args.redditor or self._args.comments or self._args.basic: """ Run PRAW scrapers. """ Validation.validate_user(self._parser, self._reddit) if self._args.subreddit: RunSubreddit.run(self._args, self._parser, self._reddit) if self._args.redditor: RunRedditor.run(self._args, self._parser, self._reddit) if self._args.comments: RunComments.run(self._args, self._parser, self._reddit) elif self._args.basic: RunBasic.run(self._args, self._parser, self._reddit) elif self._args.live_subreddit or self._args.live_redditor: """ Run PRAW livestream scrapers. """ Validation.validate_user(self._parser, self._reddit) Livestream.stream(self._args, self._reddit) elif self._args.frequencies or self._args.wordcloud: """ Run analytical tools. """ if self._args.frequencies: GenerateFrequencies.generate(self._args) if self._args.wordcloud: GenerateWordcloud.generate(self._args)