Example #1
0
def gen_articles(total_items=20):
    for _ in range(total_items):
        basic_attr = {
            "name": loremipsum.sentence(max_char=choice(range(10, 20))),
            "image": None,
            "description": loremipsum.paragraph(),
        }
        publish_datetime = __gen_random_datetime(MOCK_DATE_RANGE_DAYS)
        items.save_item(basic_attr, ARTICLE_PATH, publish_datetime)
Example #2
0
def save_article(attr_dic):
    return items.save_item(attr_dic, ARTICLE_PATH)