예제 #1
0
def do_work_son(args):
    cwd = os.path.dirname(os.path.abspath(__file__))
    config_file = args.config_file or \
        get_config_file_from_default_locations(cwd)
    config = get_config(config_file)

    ACCESS_KEY = config.get(CONFIG_SECTION, 'ACCESS_KEY')
    ACCESS_SECRET = config.get(CONFIG_SECTION, 'ACCESS_SECRET')

    logging.debug("Accessing twitters with access key: {0}".format(ACCESS_KEY))
    logging.debug("Accessing twitters with access secret: {0}".format(ACCESS_SECRET))

    # ask database for users
    users = get_all_users()

    # for each user, use consumer_key, consumer_secret
    for user in users:
        for favorite in user.following:
            if favorite.last_update > (datetime.datetime.utcnow() + timedelta(mins=15)):
                new_favorites = get_favorites_since(favorites.last_update_id)
                for new_favorite in new_favorites:
                    save(new_favorite)
예제 #2
0
 def test_get_config_with_invalid_config_raises_exception(self):
     get_config('/b/a/d/config')
예제 #3
0
 def test_get_config_with_config_returns_valid_config(self):
     config = get_config(self.config_file)
     ok_(config is not None)