Exemplo n.º 1
0
def mock_mentions(times_to_mock=5):
    for _ in range(times_to_mock):
        m = Mention()
        m.alert_id = _gen_uuid()
        m.url = "http://unifide.sg"
        m.title = loremipsum.sentence(max_char=choice(range(20, 30)))
        m.summary = loremipsum.sentence(max_char=choice(range(20, 30)))
        m.keyword = _gen_uuid()
        Mention.collection().save(m.serialize())
Exemplo n.º 2
0
def _save_mention(keyword, feed_entry):
    coll = Mention.collection()
    mention_obj = Mention()
    mention_obj.url = feed_entry["link"]
    mention_obj.summary = feed_entry["summary"]
    mention_obj.title = feed_entry["title"]
    mention_obj.alert_id = feed_entry["id"]
    mention_obj.keyword = keyword
    mention_obj.modification_timestamp_utc = datetime.fromtimestamp(mktime(feed_entry["published_parsed"]))
    coll.save(mention_obj.serialize())