def _tip_from_tweet(embedded): """Convert a ``dict`` we got from Twitter into a ``Tip``.""" t = Tip() t.author_name = embedded['author_name'] t.author_url = embedded['author_url'] t.publication_date = extract_publication_date(embedded['html']) t.rendered_html = embedded['html'] t.url = embedded['url'] return t
def _update_tip(tip): tip.publication_date = extract_publication_date(tip.rendered_html)