Beispiel #1
0
def show_search():
    user = get_logged_in_user()
    phrase = request.query.get('phrase', '')
    posts = pubsub.search(phrase, limit=10)
    heading = f'Posts matching: {phrase}'
    return dict(user=user, posts=posts, heading=heading, comb=comb)
Beispiel #2
0
    pprint(dict(followers))

    print('\nFollowing')
    pprint(dict(following))

    print("\nUser info")
    pprint(user_info)

    print('-' * 50)

    print('\nPosts by felix (3)')
    pprint(posts_by_user('felix', limit=3))

    print('\nPosts for homer (6)')
    pprint(posts_for_user('homer', limit=6))

    print('\nSearch for #python (4)')
    pprint(search('#python', limit=4))

    print("\nFelix 's followers")
    pprint(get_followers('felix'))

    print("\nHomer follows")
    pprint(get_followed('homer'))

    print("\nPopeye's info")
    print(get_user('popeye'))

    print("\nPost ages")
    pprint(list(map(age, posts)))
Beispiel #3
0
def show_search():
    user = get_logged_in_user()
    phrase = request.query.get('phrase', '')
    posts = pubsub.search(phrase, limit=10)
    heading = f'Posts matching: {phrase}'
    return dict(user=user, posts=posts, heading=heading, comb=comb)
Beispiel #4
0
def show_search() -> dict:
    user = get_logged_in_user()
    phrase = request.query.get("phrase", "")
    posts = pubsub.search(phrase, limit=10)
    heading = f"Posts matching: {phrase}"
    return dict(user=user, posts=posts, heading=heading, comb=comb)
Beispiel #5
0
    from pubsub import posts_by_user, posts_for_user, search
    from pubsub import get_followers, get_followed, get_user, check_user, age

    assert check_user('raymondh', password='******')
    assert not check_user('davin', password='******')

    print()
    pprint(list(posts))
    print('\nFollowers')
    pprint(dict(followers))
    print('\nFollowing')
    pprint(dict(following))
    print("\nUser info")
    pprint(user_info)
    print('-' * 50)

    print('\nPosts by raymondh (3)')
    pprint(posts_by_user('raymondh', limit=3))
    print('\nPosts for davin (6)')
    pprint(posts_for_user('davin', limit=6))
    print('\nSearch for #python (4)')
    pprint(search('#python', limit=4))
    print("\nRaymond's followers")
    pprint(get_followers('raymondh'))
    print("\nDavin follows")
    pprint(get_followed('davin'))
    print("\nBarry's info")
    print(get_user('barry'))
    print("\nPost ages")
    pprint(list(map(age, posts)))
Beispiel #6
0
    assert not check_user("davin", password="******")

    print()
    pprint(list(posts))
    print("\nFollowers")
    pprint(dict(followers))
    print("\nFollowing")
    pprint(dict(following))
    print("\nUser info")
    pprint(user_info)
    print("-" * 50)

    print("\nPosts by raymondh (3)")
    pprint(posts_by_user("raymondh", limit=3))
    print("\nPosts for davin (6)")
    pprint(posts_for_user("davin", limit=6))
    print("\nSearch for #python (4)")
    pprint(search("#python", limit=4))
    print("\nSearch for python (4)")
    pprint(search("python", limit=4))
    print("\nRaymond's followers")
    pprint(get_followers("raymondh"))
    print("\nDavin follows")
    pprint(get_followed("davin"))
    print("\nBarry's info")
    print(get_user("barry"))
    print("\nPost ages")
    pprint(list(map(age, posts)))
    print("\nHash tag index:")
    pprint(hashtag_index)