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)))
def verify_user_exists(user) -> None: pubsub.get_user(user) or abort(404, f'Unknown user: {user!r}')
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)))
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)
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)