コード例 #1
0
    def test_user_oper(self):
        user_list = list()
        for fake_id in FAKE_IDS:
            user_list.append(User(fake_id))
        UserOper.add_all(user_list)

        rs = db_session.execute('select * from {}'.format(wbuser.name))
        assert rs.rowcount > 0

        assert UserOper.get_user_by_uid('5') is None
        assert UserOper.get_user_by_uid(FAKE_ID) is not None
コード例 #2
0
    def test_user_oper(self):
        user_list = list()
        for fake_id in FAKE_IDS:
            user_list.append(User(fake_id))
        UserOper.add_all(user_list)

        rs = db_session.execute('select * from {}'.format(wbuser.name))
        assert rs.rowcount > 0

        assert UserOper.get_user_by_uid('5') is None
        assert UserOper.get_user_by_uid(FAKE_ID) is not None
コード例 #3
0
ファイル: user.py プロジェクト: 402730243/spider-weibo
def get_user_profile(user_id):
    """
    :param user_id: uid
    :return: user info and is crawled or not
    """
    user = UserOper.get_user_by_uid(user_id)

    if user:
        storage.info('user {id} has already crawled'.format(id=user_id))
    else:
        user = get_url_from_web(user_id)
    return user
コード例 #4
0
ファイル: user.py プロジェクト: ResolveWang/WeiboSpider
def get_user_profile(user_id):
    """
    :param user_id: uid
    :return: user info and is crawled or not
    """
    user = UserOper.get_user_by_uid(user_id)

    if user:
        storage.info('user {id} has already crawled'.format(id=user_id))
    else:
        user = get_url_from_web(user_id)
    return user
コード例 #5
0
ファイル: user.py プロジェクト: 402730243/spider-weibo
def get_profile(user_id):
    """
    :param user_id: uid
    :return: user info and is crawled or not
    """
    user = UserOper.get_user_by_uid(user_id)

    if user:
        storage.info('user {id} has already crawled'.format(id=user_id))
        SeedidsOper.set_seed_crawled(user_id, 1)
        is_crawled = 1
    else:
        user = get_url_from_web(user_id)
        if user is not None:
            SeedidsOper.set_seed_crawled(user_id, 1)
        else:
            SeedidsOper.set_seed_crawled(user_id, 2)
        is_crawled = 0

    return user, is_crawled
コード例 #6
0
ファイル: user.py プロジェクト: ResolveWang/WeiboSpider
def get_profile(user_id):
    """
    :param user_id: uid
    :return: user info and is crawled or not
    """
    user = UserOper.get_user_by_uid(user_id)

    if user:
        storage.info('user {id} has already crawled'.format(id=user_id))
        SeedidsOper.set_seed_crawled(user_id, 1)
        is_crawled = 1
    else:
        user = get_url_from_web(user_id)
        if user is not None:
            SeedidsOper.set_seed_crawled(user_id, 1)
        else:
            SeedidsOper.set_seed_crawled(user_id, 2)
        is_crawled = 0

    return user, is_crawled