def sources_post(): feed_url = request.form['feed'] parsed = feed.parse(feed_url) feed_source = feed.get_source(parsed) source = FeedSource.insert_from_feed(feed_url, feed_source) feed_articles = feed.get_articles(parsed) Article.insert_from_feed(source.sid, feed_articles) return redirect('/sources')
def update_source(src): parsed = feed.parse(src.feed) feed_articles = feed.get_articles(parsed) article.Article.insert_from_feed(src.id, feed_articles) print('Updated '+ src.feed)