def run(r, tor, config):
    """
    Primary routine.
    
    :param r: Active Reddit connection. 
    :param tor: ToR subreddit object.
    :param config: Global config dict.
    :return: None.
    """
    try:
        check_inbox(r, tor, config)

        for sub in config.subreddits_to_check:
            check_submissions(sub, r, tor, config)

        set_meta_flair_on_other_posts(r, tor, config)

        if config.debug_mode:
            time.sleep(60)

    except (
        prawcore.exceptions.RequestException,
        prawcore.exceptions.ServerError,
        # this will also trigger if we get banned from somewhere.
        # We will need to plan on some jerk banning us without warning,
        # but for now we will treat is as an API error and try again.
        prawcore.exceptions.Forbidden
    ) as e:
        logging.error(
            '{} - Issue communicating with Reddit. Sleeping for 60s!'
            ''.format(e)
        )
        time.sleep(60)
Exemple #2
0
def run(cfg):
    """
    Primary routine.

    :param cfg: Global config dict, supplied by tor_core.
    :return: None.
    """
    check_inbox(cfg)

    threaded_check_submissions(cfg)

    set_meta_flair_on_other_posts(cfg)

    if cfg.debug_mode:
        time.sleep(60)
Exemple #3
0
def run(config):
    """
    Primary routine.

    :param config: Global config dict, supplied by tor_core.
    :return: None.
    """
    check_inbox(config)

    for sub in config.subreddits_to_check:
        check_submissions(sub, config)

    set_meta_flair_on_other_posts(config)

    if config.debug_mode:
        time.sleep(60)