def print_page_list(): for p in pages.find(): print("ID - {id}, name - {name}, fans - {fan_count}".format(**p))
def get_page_list(): return list(pages.find())
def get_best_posts_per_page(limit=3): pages_with_best_posts = dict() for page in pages.find(): pages_with_best_posts[page['id']] = get_posts_ordered_by_score( page['id'], limit) return pages_with_best_posts
def update_posts_per_page(post_limit=300): with futures.ThreadPoolExecutor(max_workers=10) as executor: for page in pages.find(): executor.submit(async_posts_update, page, post_limit) print("Done")
def get_best_posts_per_page(limit=3): pages_with_best_posts = dict() for page in pages.find(): pages_with_best_posts[page['id']] = get_posts_ordered_by_score(page['id'], limit) return pages_with_best_posts